RagaSGNur
RagaSGNur

Reputation: 359

Pie Mutation test fails : org.pitest.mutationtest.engine.gregor.mutators.EmptyObjectReturnValsMutator

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?

Upvotes: 1

Views: 2130

Answers (1)

RagaSGNur
RagaSGNur

Reputation: 359

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.

Upvotes: 1

Related Questions