File tree Expand file tree Collapse file tree
config/pitest-suppressions
main/java/com/puppycrawl/tools/checkstyle/checks/imports
test/java/com/puppycrawl/tools/checkstyle/checks/imports Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
9880 <description >Removed assignment to member variable regex</description >
9981 <lineContent >this.regex = false;</lineContent >
10082 </mutation >
101-
10283</suppressedMutations >
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change 2626
2727import java .io .File ;
2828import java .util .Optional ;
29+ import java .util .regex .Pattern ;
2930
3031import org .antlr .v4 .runtime .CommonToken ;
3132import 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
You can’t perform that action at this time.
0 commit comments