I'm trying to create some JUnit tests for my methods and I've been told to do it for every single method. I know it's a pitfall for beginners to only do positive tests so how can I test this method more than I already have? Also both of my test methods test the same thing essentially. What would be an example of a negative test here or is that redundant work?
public static MemberCont getInstance() {
if(instance == null) {
instance = new MemberCont();
}
return instance;
}
@Test
public void getInstance() {
assertNotNull(memberCo1.getInstance());
assertEquals(true, memberCo1.getInstance() != null);
}