Skip to content

Commit

Permalink
Issue checkstyle#7874: Resolve Pitest Issues - ImportOrderCheck (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrmancuso committed Mar 29, 2020
1 parent fab949a commit 4070c2c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 0 additions & 1 deletion .ci/pitest.sh
Expand Up @@ -76,7 +76,6 @@ pitest-imports)
"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'> else if (matcher.start() == bestPos &#38;&#38; matcher.end() &#62; bestEnd) {</span></pre></td></tr>"
"ImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> final boolean separatorBetween = isStatic != lastImportStatic</span></pre></td></tr>"
"ImportOrderCheck.java.html:<td class='covered'><pre><span class='survived'> if (caseSensitive) {</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'> if (isStatic) {</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>"
Expand Down
Expand Up @@ -794,6 +794,22 @@ public void testUseContainerOrderingForStaticTrueCaseSensitive() throws Exceptio
verify(checkConfig, getNonCompilablePath("InputImportOrderEclipseStatic.java"), expected);
}

@Test
public void testUseContainerOrderingForStatic() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class);
checkConfig.addAttribute("ordered", "true");
checkConfig.addAttribute("sortStaticImportsAlphabetically", "true");
checkConfig.addAttribute("useContainerOrderingForStatic", "true");
final String[] expected = {
"6:1: " + getCheckMessage(MSG_ORDERING,
"io.netty.handler.Codec.HTTP.HttpHeaders.elvis.same"),
"7:1: " + getCheckMessage(MSG_ORDERING,
"io.netty.handler.Codec.HTTP.HttpHeaders.TPARK.same"),
};
verify(checkConfig, getNonCompilablePath("InputImportOrderContainerOrdering.java"),
expected);
}

@Test
public void testImportGroupsRedundantSeparatedInternally() throws Exception {
final DefaultConfiguration checkConfig = createModuleConfig(ImportOrderCheck.class);
Expand Down
@@ -0,0 +1,11 @@
//non-compiled with javac: contains specially crafted set of imports for testing
package com.puppycrawl.tools.checkstyle.checks.imports.importorder;
import static io.netty.handler.codec.http.HttpConstants.COLON;
import static io.netty.handler.codec.http.HttpHeaders.addHeader;
import static io.netty.handler.codec.http.HttpHeaders.setHeader;
import static io.netty.handler.Codec.HTTP.HttpHeaders.elvis.same;
import static io.netty.handler.Codec.HTTP.HttpHeaders.TPARK.same;

public class InputImportOrderContainerOrdering {

}

0 comments on commit 4070c2c

Please sign in to comment.