Skip to content

Commit

Permalink
Issue #7802: Resolve Pitest Issues - CustomImportOrderCheck (1)
Browse files Browse the repository at this point in the history
  • Loading branch information
wltan authored and rnveach committed Mar 12, 2020
1 parent f0fd9e4 commit 91f13c1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .ci/pitest.sh
Expand Up @@ -73,11 +73,9 @@ 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>"
"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>"
"CustomImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> if (customImportOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) {</span></pre></td></tr>"
"CustomImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> || length == betterMatchCandidate.matchLength</span></pre></td></tr>"
"IllegalImportCheck.java.html:<td class='covered'><pre><span class='survived'> if (regexp) {</span></pre></td></tr>"
"IllegalImportCheck.java.html:<td class='covered'><pre><span class='survived'> if (!result &#38;&#38; illegalClasses != null) {</span></pre></td></tr>"
"IllegalImportCheck.java.html:<td class='covered'><pre><span class='survived'> if (!result) {</span></pre></td></tr>"
Expand Down
Expand Up @@ -721,6 +721,24 @@ public void testMultiplePatternMatchesFirstPatternHasEarlierPosition() throws Ex
expected);
}

@Test
public void testMultiplePatternMultipleImportFirstPatternHasLaterPosition() throws Exception {
final DefaultConfiguration checkConfig =
createModuleConfig(CustomImportOrderCheck.class);
checkConfig.addAttribute("customImportOrderRules",
"SPECIAL_IMPORTS###STANDARD_JAVA_PACKAGE");
checkConfig.addAttribute("specialImportsRegExp", "Test");
checkConfig.addAttribute("standardPackageRegExp", "unit");

createChecker(checkConfig);
final String[] expected = {
"4: " + getCheckMessage(MSG_NONGROUP_EXPECTED, STD, "org.junit.Test"),
};
verify(checkConfig,
getPath("InputCustomImportOrder_MultiplePatternMultipleImport.java"),
expected);
}

@Test
public void testNoPackage() throws Exception {
final DefaultConfiguration checkConfig =
Expand Down
@@ -0,0 +1,7 @@
package com.puppycrawl.tools.checkstyle.checks.imports.customimportorder;

import java.util.Scanner;
import org.junit.Test;

public class InputCustomImportOrder_MultiplePatternMultipleImport {
}

0 comments on commit 91f13c1

Please sign in to comment.