Skip to content

Commit

Permalink
Issue checkstyle#7799: Resolve Pitest Issues - AvoidStarImportCheck (1)
Browse files Browse the repository at this point in the history
  • Loading branch information
wilcoln committed Mar 13, 2020
1 parent ce28f73 commit be85b6b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion .ci/pitest.sh
Expand Up @@ -71,7 +71,6 @@ pitest-header)
pitest-imports)
mvn -e -P$1 clean test org.pitest:pitest-maven:mutationCoverage;
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>"
"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 @@ -95,6 +95,22 @@ public void testAllowStaticMemberImports() throws Exception {
verify(checkConfig, getPath("InputAvoidStarImportDefault.java"), expected2);
}

@Test
public void testDenyStaticMemberImports() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(AvoidStarImportCheck.class);
checkConfig.addAttribute("allowStaticMemberImports", "false");
// deny all static star imports
final String[] expected2 = {
"7: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.*"),
"9: " + getCheckMessage(MSG_KEY, "java.io.*"),
"10: " + getCheckMessage(MSG_KEY, "java.lang.*"),
"25: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
"28: " + getCheckMessage(MSG_KEY, "java.io.File.*"),
};
verify(checkConfig, getPath("InputAvoidStarImportDefault.java"), expected2);
}

@Test
public void testGetAcceptableTokens() {
final AvoidStarImportCheck testCheckObject =
Expand Down

0 comments on commit be85b6b

Please sign in to comment.