Mutator for null checking method arguments

Skip to first unread message

Tim Fulcher

Jun 13, 2022, 7:51:29 AMJun 13

I'm relatively new to PIT but I can I ask why I don't appear to see a mutator that attempts to take method Object arguments and replace them with nulls?
It's a bit contrived I suppose, but in the past I've seen test cases that always deal with non null arguments and pass fine, but the code blows up in production when upstream from a method call an input argument becomes a null, throwing a NPE. Of course it's highly likely the test itself completely fails, it's more around detecting when the test code doesn't cover that behaviour. I guess the mutant doesn't survive either way which is perhaps the difficulty 



Henry Coles

Jun 13, 2022, 8:17:25 AMJun 13
An operator such as the one you describe would be 'unstable', that is to say highly likely to make any test that exercised it fail due to a NullPointerException. So while it might be possible, it probably wouldn't be very valuable. The more useful operators are generally more stable, ie they produce mutants that are harder to detect.

For example, mutating  x > y to x >= y, is much more likely to find interesting issues then mutating it to x < y, as the mutant is distinguished from the original program by far fewer inputs.


You received this message because you are subscribed to the Google Groups "PIT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
Reply all
Reply to author
0 new messages