Skip to content

Commit e0e1161

Browse files
committed
minor: just to show how to kill mutation
1 parent d7f234a commit e0e1161

3 files changed

Lines changed: 13 additions & 20 deletions

File tree

config/pitest-suppressions/pitest-imports-suppressions.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,6 @@
3636
<lineContent>final boolean regex = containsRegexAttribute(attributes);</lineContent>
3737
</mutation>
3838

39-
40-
41-
42-
43-
44-
45-
46-
47-
48-
49-
50-
51-
52-
53-
54-
55-
56-
5739
<mutation unstable="false">
5840
<sourceFile>ImportOrderCheck.java</sourceFile>
5941
<mutatedClass>com.puppycrawl.tools.checkstyle.checks.imports.ImportOrderCheck</mutatedClass>
@@ -98,5 +80,4 @@
9880
<description>Removed assignment to member variable regex</description>
9981
<lineContent>this.regex = false;</lineContent>
10082
</mutation>
101-
10283
</suppressedMutations>

src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ else if (!isStatic && option == ImportOrderOption.TOP) {
10841084
* @param name the import name to find.
10851085
* @return group number for given import name.
10861086
*/
1087-
private static int getGroupNumber(Pattern[] patterns, String name) {
1087+
static int getGroupNumber(Pattern[] patterns, String name) {
10881088
int bestIndex = patterns.length;
10891089
int bestEnd = -1;
10901090
int bestPos = Integer.MAX_VALUE;

src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/ImportOrderCheckTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import java.io.File;
2828
import java.util.Optional;
29+
import java.util.regex.Pattern;
2930

3031
import org.antlr.v4.runtime.CommonToken;
3132
import org.junit.jupiter.api.Test;
@@ -787,6 +788,17 @@ public void testTrimOption() throws Exception {
787788
expected);
788789
}
789790

791+
@Test
792+
public void testPites() throws Exception {
793+
Pattern[] patterns = new Pattern[3];
794+
patterns[0] = Pattern.compile("java");
795+
patterns[1] = Pattern.compile(".*.my");
796+
patterns[2] = Pattern.compile(".*.mycom");
797+
assertWithMessage("failed")
798+
.that(ImportOrderCheck.getGroupNumber(patterns, "java.mycom."))
799+
.isEqualTo(2);
800+
}
801+
790802
/**
791803
* Finding the appropriate input for testing the "lastImportStatic"
792804
* field is challenging. Removing it from the reset process might

0 commit comments

Comments
 (0)