Issue #7800: Resolve Pitest Issues - AvoidStarImportCheck(2) #7840
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #7800: Resolve Pitest Issues - AvoidStaticImportCheck(2)
As described as in #7800:
Pitest report
Link: https://huganghui.github.io/7800-AvoidStarImportCheck(2)/before-pit-reports/202003131405/
Surviving mutations:
on line 188: removed conditional - replaced equality check with false → SURVIVED I am focusing on it.
on line 224: removed conditional - replaced equality check with true → SURVIVED referenced by #7799, wilcoln is focusing on it.
Hardcoded mutation
mutation cs branch: HuGanghui@1578ac0
comment:
Looking at the pitest report, we can see that the surviving mutation is the one for which removed conditional - replaced equality check with false → SURVIVED, this is equivalent as simply removing the entire condition and keeping only the else body. Which I did.
Regression diff report
Used only guava and elastic-search, but there is no diff found.
Link: https://huganghui.github.io/7800-AvoidStarImportCheck(2)/hardcoded-reports/diff/
Code Logic Analysis
Although there is no diff found in Regression diff report, I find that the reason why the surviving mutation exists is maybe a small oversight in an existing UT , details as follows:
checkstyle/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckTest.java
Line 63 in 91f13c1
javax.swing.WindowConstants is redundant in this UT, so I remove this import and do Pitest, report shows it can kill the mutation.
Pitest report after removing redundant code in the UT mentioned above
Link: https://huganghui.github.io/7800-AvoidStarImportCheck(2)/after-pit-reports/202003131742/
now on line 188, is KILLED
on line 188: removed conditional - replaced equality check with false → KILLED