Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #7801: Resolve Pitest Issues - AvoidStaticImportCheck #7828

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .ci/pitest.sh
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ 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.E"),
"30: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"32: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -76,10 +78,12 @@ 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.E"),
"30: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"32: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -91,17 +95,18 @@ public void testMemberExcludes()
throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(AvoidStaticImportCheck.class);
checkConfig.addAttribute("excludes", "java.io.File.listRoots");
// allow the java.io.File.listRoots member imports
checkConfig.addAttribute("excludes", "java.io.File.listRoots,java.lang.Math.E");
strkkk marked this conversation as resolved.
Show resolved Hide resolved
// allow the java.io.File.listRoots and java.lang.Math.E 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,
"30: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"32: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -126,10 +131,12 @@ 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.E"),
"30: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
"30: " + getCheckMessage(MSG_KEY,
"32: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass.one"),
};
Expand All @@ -154,7 +161,9 @@ 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.E"),
"30: " + getCheckMessage(MSG_KEY, "java.lang.Math.sqrt"),
"31: " + getCheckMessage(MSG_KEY,
"com.puppycrawl.tools.checkstyle.checks.imports."
+ "avoidstaticimport.InputAvoidStaticImportNestedClass.InnerClass"),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import static javax.swing.WindowConstants.*;
import static java.io.File.createTempFile;
import static java.io.File.pathSeparator;
import static java.lang.Math.E;
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