Skip to content

Commit

Permalink
Issue checkstyle#7801: Resolve Pitest Issues - AvoidStaticImportCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurabdg committed Mar 11, 2020
1 parent e73ec41 commit e3af121
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion .ci/pitest.sh
Expand Up @@ -73,7 +73,6 @@ pitest-imports)
declare -a ignoredItems=(
"AvoidStarImportCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; ast.getType() == TokenTypes.STATIC_IMPORT) {</span></pre></td></tr>"
"AvoidStarImportCheck.java.html:<td class='covered'><pre><span class='survived'> if (exclude.endsWith(STAR_IMPORT_SUFFIX)) {</span></pre></td></tr>"
"AvoidStaticImportCheck.java.html:<td class='covered'><pre><span class='survived'> if (exclude.endsWith(&#34;.*&#34;)) {</span></pre></td></tr>"
"CustomImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> &#38;&#38; matcher.start() &#60; betterMatchCandidate.matchPosition) {</span></pre></td></tr>"
"CustomImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> else if (customImportOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) {</span></pre></td></tr>"
"CustomImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> if (bestMatch.group.equals(NON_GROUP_RULE_GROUP)) {</span></pre></td></tr>"
Expand Down
Expand Up @@ -55,10 +55,11 @@ public void testDefaultOperation()
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"27: " + getCheckMessage(MSG_KEY, "java.io.File.createTempFile"),
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"29: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -76,10 +77,11 @@ public void testStarExcludes()
final String[] expected = {
"25: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"29: " + getCheckMessage(MSG_KEY,
"29: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -91,17 +93,18 @@ public void testMemberExcludes()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(AvoidStaticImportCheck.class);
checkConfig.addAttribute("excludes", "java.io.File.listRoots");
checkConfig.addAttribute("excludes", "java.io.File.listRoots,java.lang.Math.E");
// allow the java.io.File.listRoots member imports
final String[] expected = {
"25: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"27: " + getCheckMessage(MSG_KEY, "java.io.File.createTempFile"),
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"29: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -126,10 +129,11 @@ public void testBogusMemberExcludes()
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"27: " + getCheckMessage(MSG_KEY, "java.io.File.createTempFile"),
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"29: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -154,7 +158,8 @@ public void testInnerClassMemberExcludesStar()
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"27: " + getCheckMessage(MSG_KEY, "java.io.File.createTempFile"),
"28: " + getCheckMessage(MSG_KEY, "java.io.File.pathSeparator"),
"29: " + getCheckMessage(MSG_KEY,
"29: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"30: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
};
Expand Down
Expand Up @@ -26,6 +26,7 @@
import static javax.swing.WindowConstants.*;
import static java.io.File.createTempFile;
import static java.io.File.pathSeparator;
import static java.lang.Math.sqrt;
import static com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass;
import static com.puppycrawl.tools.checkstyle.checks.imports.avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one;

Expand Down

0 comments on commit e3af121

Please sign in to comment.