I have a method that returns a custom object
public MyObject getTheObject(){
...
return muObject;
}
its unit test checks that the object returned by getTheObject()
method is not null
@Test
public void testGetTheObject(){
...
assertNotNull(actualObject);
}
and test passes.
When running mutation test with Pitest it shows one SURVIVED
mutation which says something like this:
mutated returned of Object for value for ..../getTheObject to ( if ( x!= null ) null else throw new RuntimeException )
The question is what should our unit test look like to get rid of this issue, and KILL
that mutation