1

While running mutation test , there are survived cases . The reason is org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator

The exact error message is : replaced return value with Collections.emptyList for package/JavaFile::Method → SURVIVED

I added few test cases to pass the emptyList but still failed.Can anyone please help here about this and what's the test case need to be added?

RagaSGNur
  • 199
  • 1
  • 2
  • 15
  • Include a test case that verifies that the return value is not equal to `Collections.emptyList()`. That mutation will make it fail, therefore effectively killing the mutant. – JustAnotherDeveloper May 22 '22 at 15:54

1 Answers1

1

There is a typical case for a method which returns Set.

Example: private Set execute() { }

This set is always with value (or) empty set.

The call to this method 'return execute()' showed the issue of replaced return value with Collections.emptyList for package/JavaFile::Method → SURVIVED.

The logic is changed like 'return Optional.of(execute())'

This solved the issue.

RagaSGNur
  • 199
  • 1
  • 2
  • 15