After #12151 gets merged, it will introduce 2 new surviving mutations.
<mutation unstable="false">
<sourceFile>SuppressWithNearbyTextFilter.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter</mutatedClass>
<mutatedMethod>accept</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator</mutator>
<description>removed call to java/lang/String::equals</description>
<lineContent>if (!cachedFileAbsolutePath.equals(eventFileTextAbsolutePath)) {</lineContent>
</mutation>
<mutation unstable="false">
<sourceFile>SuppressWithNearbyTextFilter.java</sourceFile>
<mutatedClass>com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyTextFilter</mutatedClass>
<mutatedMethod>accept</mutatedMethod>
<mutator>org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF</mutator>
<description>removed conditional - replaced equality check with true</description>
<lineContent>if (!cachedFileAbsolutePath.equals(eventFileTextAbsolutePath)) {</lineContent>
</mutation>
First is the real line and the hardcoded mutation below it:
if (!cachedFileAbsolutePath.equals(eventFileTextAbsolutePath)) {
The mutation shows that there is no test to assert that the caching happens only once per file.
We need to write a test to assert that any method inside the if statement is called only once - could be collectSuppressions() or getFileText().
Because getFileText()'s implementation is the exact same in both this filter and SuppressWithPlainTextCommentFilter, it can be extracted to FilterUtil and we can assert that this method is invoked only once - 383b079
After #12151 gets merged, it will introduce 2 new surviving mutations.
First is the real line and the hardcoded mutation below it:
The mutation shows that there is no test to assert that the caching happens only once per file.
We need to write a test to assert that any method inside the
ifstatement is called only once - could becollectSuppressions()orgetFileText().Because
getFileText()'s implementation is the exact same in both this filter andSuppressWithPlainTextCommentFilter, it can be extracted toFilterUtiland we can assert that this method is invoked only once - 383b079