Issue #13501: Kill mutation for ImportOrderCheck-2#13232
Issue #13501: Kill mutation for ImportOrderCheck-2#13232romani merged 1 commit intocheckstyle:masterfrom
Conversation
|
Github, generate report |
|
Github, generate report |
|
Github, generate report |
|
Github, generate report |
| } | ||
| else if (matcher.start() == bestPos && matcher.end() > bestEnd) { | ||
| bestIndex = i; | ||
| bestEnd = matcher.end(); |
There was a problem hiding this comment.
This update means that we do select of first match.
To use this method, we need to make config, where user provided multiple patterns that overlap and we have import that can match several, and we select only best match.
So regression will not find anything, we just need to make bunch of unrealistic configs.
To catch a case, you can make this method as public, and trace all possible values to patterns and name to catch what we need. After that you simply take required patterns and put in Input.
There was a problem hiding this comment.
@Kevin222004 , ping.
Please play with almost same groups.
There was a problem hiding this comment.
@Kevin222004 , here is how to quicky play with this methods coverage - e0e1161
ones you kill it by pure unit test, you can convert it to Input based.
There was a problem hiding this comment.
It is getting a long delay in this pr but I am trying to find test
Just a update on this pr I have found a pure ut which kill one mutation if (matcher.start() < bestPos) {
@Test
public void testPitest() throws Exception {
Pattern[] patterns = new Pattern[6];
patterns[0] = Pattern.compile("awt");
patterns[5] = Pattern.compile("jarInputStream");
patterns[4] = Pattern.compile(".util");
patterns[3] = Pattern.compile(".jar.");
patterns[2] = Pattern.compile(".util.");
patterns[1] = Pattern.compile("jar");
assertWithMessage("")
.that(ImportOrderCheck.getGroupNumber(patterns, "java.util.jar.JarInputStream"))
.isEqualTo(4);
}
I am trying to make this input base and also for other mutation trying to find test
There was a problem hiding this comment.
we missed a fact that we treat provided packages as full name from the beginning,
so we can not use .util or awt , all patterns must have full name from the beginning. So it meant that getGroupNumber should be aware of this, so finding most early bestPos is nonsense at line if (matcher.start() < bestPos) {.
There was a problem hiding this comment.
ok, we can use regexp, but we have to use / around values to make it treated as-is - https://checkstyle.org/checks/imports/importorder.html#Properties
532f58f to
065ca7c
Compare
|
Just test, we merge on single review. |
Issue #13501: Kill mutation for ImportOrderCheck-2
Check :
https://checkstyle.org/config_imports.html#ImportOrder
https://checkstyle.org/checks/imports/importorder.html#ImportOrder
Mutation covered
checkstyle/config/pitest-suppressions/pitest-imports-suppressions.xml
Lines 57 to 73 in 58fdccf
Explaination
https://pitest.org/quickstart/mutators/#non-void-method-call-mutator-non_void_method_calls
test was added.
Regression
Diff Regression config: https://gist.githubusercontent.com/Kevin222004/64068f25e12fc53287e29c691b44b0cd/raw/3f08e73e3946ef9ef59bd119028bb67eff99b15b/ImportOrder.xml
Diff Regression projects: https://gist.githubusercontent.com/Kevin222004/21e3934e85f802e2fbd48af06d122364/raw/604256badd733d8568064f371d55657c04b00dfd/test-projects-2.properties
Report label: R2