Java Stream API and Reactive Streams are increasingly popular and both Gregor and Descartes fail to produce good mutations for programs using those APIs (also for Fluent APIs, but this is addressed in #97).
One improvement that seems to be not too complicated yet effective is to mutate by returning the function argument.
Example
Let's take a typical map operator:
.map(filePath -> toAbsolutePath(filePath))
Here the lambda is Function<String, String>. Until now Pitest is only able to mutate into:
.map(filePath -> null)
This isn't very effective as a simple null-check will kill the mutation. In language like Kotlin you don't even need to insert null-checks manually.
A much better mutation would be to return the argument, thereby introducing a much more subtle 'bug':
.map(filePath -> filePath)
Further extensions
It would be great if the mutation was able to mutate functions with more than one argument, where at least one argument has the same type as the return value. But even mutating just Function<T, T> would be a significant improvement.
Java Stream API and Reactive Streams are increasingly popular and both Gregor and Descartes fail to produce good mutations for programs using those APIs (also for Fluent APIs, but this is addressed in #97).
One improvement that seems to be not too complicated yet effective is to mutate by returning the function argument.
Example
Let's take a typical
map
operator:Here the lambda is
Function<String, String>
. Until now Pitest is only able to mutate into:This isn't very effective as a simple null-check will kill the mutation. In language like Kotlin you don't even need to insert null-checks manually.
A much better mutation would be to return the argument, thereby introducing a much more subtle 'bug':
Further extensions
It would be great if the mutation was able to mutate functions with more than one argument, where at least one argument has the same type as the return value. But even mutating just
Function<T, T>
would be a significant improvement.