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
SURVIVED
andKILL
mean in this context. Please show us the code that produces the output that you're asking about. There's no way we can guess what's going on just from some random error message. – Ithyphallicx
in this context? – Verdun> org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator >> Generated 2 Killed 1 (50%) > KILLED 1 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 > MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0 > NO_COVERAGE 1
– Amateurism