Skip to content

Commit

Permalink
Issue #7875: resolve pitest issue for ImportOrderCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
strkkk authored and romani committed Dec 21, 2020
1 parent ac1bfa1 commit 8873d99
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
1 change: 0 additions & 1 deletion .ci/pitest.sh
Expand Up @@ -64,7 +64,6 @@ pitest-imports)
mvn -e -P$1 clean test org.pitest:pitest-maven:mutationCoverage;
declare -a ignoredItems=(
"ImportControlLoader.java.html:<td class='covered'><pre><span class='survived'> else if (ALLOW_ELEMENT_NAME.equals(qName) || &#34;disallow&#34;.equals(qName)) {</span></pre></td></tr>"
"ImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> if (!CommonUtil.endsWithChar(pkg, &#39;.&#39;)) {</span></pre></td></tr>"
"ImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> return !beforeFirstImport &#38;&#38; line - lastImportLine &#62; 1;</span></pre></td></tr>"
"ImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> staticImportSeparator = isStatic &#38;&#38; separated;</span></pre></td></tr>"
"PkgImportControl.java.html:<td class='covered'><pre><span class='survived'> if (alreadyRegex) {</span></pre></td></tr>"
Expand Down
Expand Up @@ -657,10 +657,12 @@ public void testGroupWithSlashes() throws Exception {
@Test
public void testGroupWithDot() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class);
checkConfig.addAttribute("groups", "java.awt.");
final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;

verify(checkConfig, getPath("InputImportOrder_NoFailureForRedundantImports.java"),
checkConfig.addAttribute("groups", "javax.swing.,java.awt.");
final String[] expected = {
"5:1: " + getCheckMessage(MSG_ORDERING, "java.awt.Dialog"),
"7:1: " + getCheckMessage(MSG_ORDERING, "javax.swing.JComponent"),
};
verify(checkConfig, getPath("InputImportOrder_DotPackageName.java"),
expected);
}

Expand Down
@@ -0,0 +1,16 @@
package com.puppycrawl.tools.checkstyle.checks.imports.importorder;

import java.awt.Button;
import java.awt.Frame;
import java.awt.Dialog; // violation
import java.awt.event.ActionEvent;
import javax.swing.JComponent; // violation
import javax.swing.JTable;

/**
* Config:
* groups = javax.swing.,java.awt.
*/
public class InputImportOrder_DotPackageName {
}

0 comments on commit 8873d99

Please sign in to comment.