Issue #2161: unify test input locations for import package
This commit is contained in:
parent
bee6b0a1ec
commit
83e685bdac
|
|
@ -70,7 +70,7 @@ public class AllChecksTest extends BaseCheckTestSupport {
|
|||
if (check.equals(ImportControlCheck.class)) {
|
||||
// ImportControlCheck must have the import control configuration file to avoid violation.
|
||||
checkConfig.addAttribute("file",
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_complete.xml");
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/import-control_complete.xml");
|
||||
}
|
||||
checker = createChecker(checkConfig);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class FileTextTest {
|
|||
public void testSupportedCharset() throws IOException {
|
||||
String charsetName = "ISO-8859-1";
|
||||
FileText o = new FileText(new File("src/test/resources/com/puppycrawl/tools/"
|
||||
+ "checkstyle/imports/import-control_complete.xml"), charsetName);
|
||||
+ "checkstyle/checks/imports/import-control_complete.xml"), charsetName);
|
||||
assertEquals(o.getCharset().name(), charsetName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public class AvoidStarImportTest
|
|||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(AvoidStarImportCheck.class);
|
||||
final String[] expected = {
|
||||
"7: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.*"),
|
||||
"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.*"),
|
||||
|
|
@ -66,7 +66,7 @@ public class AvoidStarImportTest
|
|||
"java.io,java.lang,javax.swing.WindowConstants.*, javax.swing.WindowConstants");
|
||||
// allow the java.io/java.lang,javax.swing.WindowConstants star imports
|
||||
final String[] expected2 = {
|
||||
"7: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.*"),
|
||||
"7: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.*"),
|
||||
"28: " + getCheckMessage(MSG_KEY, "java.io.File.*"),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidStarImportCheck.java"),
|
||||
|
|
@ -91,7 +91,7 @@ public class AvoidStarImportTest
|
|||
checkConfig.addAttribute("allowStaticMemberImports", "true");
|
||||
// allow all static star imports
|
||||
final String[] expected2 = {
|
||||
"7: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.*"),
|
||||
"7: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.*"),
|
||||
"9: " + getCheckMessage(MSG_KEY, "java.io.*"),
|
||||
"10: " + getCheckMessage(MSG_KEY, "java.lang.*"),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ public class AvoidStaticImportTest
|
|||
"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, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
"29: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("InputAvoidStaticImportCheck.java"), expected);
|
||||
|
|
@ -74,8 +74,8 @@ public class AvoidStaticImportTest
|
|||
final String[] expected = {
|
||||
"25: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
|
||||
"26: " + getCheckMessage(MSG_KEY, "javax.swing.WindowConstants.*"),
|
||||
"29: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
"29: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidStaticImportCheck.java"), expected);
|
||||
}
|
||||
|
|
@ -92,8 +92,8 @@ public class AvoidStaticImportTest
|
|||
"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, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
"29: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidStaticImportCheck.java"), expected);
|
||||
}
|
||||
|
|
@ -115,8 +115,8 @@ public class AvoidStaticImportTest
|
|||
"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, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
"29: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.one"),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidStaticImportCheck.java"), expected);
|
||||
}
|
||||
|
|
@ -130,14 +130,14 @@ public class AvoidStaticImportTest
|
|||
// should mask com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one
|
||||
checkConfig.addAttribute(
|
||||
"excludes",
|
||||
"com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.*");
|
||||
"com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.*");
|
||||
final String[] expected = {
|
||||
"23: " + getCheckMessage(MSG_KEY, "java.io.File.listRoots"),
|
||||
"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, "com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
"29: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass"),
|
||||
};
|
||||
verify(checkConfig, getPath("InputAvoidStaticImportCheck.java"), expected);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import static org.junit.Assert.assertTrue;
|
|||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
|
@ -38,6 +39,17 @@ import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
|
|||
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
||||
|
||||
public class ImportControlCheckTest extends BaseCheckTestSupport {
|
||||
@Override
|
||||
protected String getPath(String filename) throws IOException {
|
||||
return super.getPath("checks" + File.separator
|
||||
+ "imports" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getUriString(String filename) {
|
||||
return super.getUriString("checks" + File.separator
|
||||
+ "imports" + File.separator + filename);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRequiredTokens() {
|
||||
|
|
@ -53,54 +65,47 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
@Test
|
||||
public void testOne() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file", "src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_one.xml");
|
||||
checkConfig.addAttribute("file", getPath("import-control_one.xml"));
|
||||
final String[] expected = {"5:1: " + getCheckMessage(MSG_DISALLOWED, "java.io.File")};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwo() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file",
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_two.xml");
|
||||
checkConfig.addAttribute("file", getPath("import-control_two.xml"));
|
||||
final String[] expected = {
|
||||
"3:1: " + getCheckMessage(MSG_DISALLOWED, "java.awt.Image"),
|
||||
"4:1: " + getCheckMessage(MSG_DISALLOWED, "javax.swing.border.*"),
|
||||
"6:1: " + getCheckMessage(MSG_DISALLOWED, "java.awt.Button.ABORT"),
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrong() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file",
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_wrong.xml");
|
||||
final String[] expected = {"1:40: " + getCheckMessage(MSG_UNKNOWN_PKG)};
|
||||
checkConfig.addAttribute("file", getPath("import-control_wrong.xml"));
|
||||
final String[] expected = {"1:47: " + getCheckMessage(MSG_UNKNOWN_PKG)};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMissing() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
final String[] expected = {"1:40: " + getCheckMessage(MSG_MISSING_FILE)};
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
final String[] expected = {"1:47: " + getCheckMessage(MSG_MISSING_FILE)};
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmpty() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file", " ");
|
||||
final String[] expected = {"1:40: " + getCheckMessage(MSG_MISSING_FILE)};
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
final String[] expected = {"1:47: " + getCheckMessage(MSG_MISSING_FILE)};
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -109,8 +114,7 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
checkConfig.addAttribute("file", "unknown-file");
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
try {
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
fail("Test should fail if exception was not thrown");
|
||||
}
|
||||
catch (CheckstyleException ex) {
|
||||
|
|
@ -122,12 +126,10 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
@Test
|
||||
public void testBroken() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file",
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_broken.xml");
|
||||
checkConfig.addAttribute("file", getPath("import-control_broken.xml"));
|
||||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
try {
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
fail("Test should fail if exception was not thrown");
|
||||
}
|
||||
catch (CheckstyleException ex) {
|
||||
|
|
@ -139,27 +141,23 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
@Test
|
||||
public void testOneRegExp() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file",
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_one-re.xml");
|
||||
checkConfig.addAttribute("file", getPath("import-control_one-re.xml"));
|
||||
final String[] expected = {"5:1: " + getCheckMessage(MSG_DISALLOWED, "java.io.File")};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTwoRegExp() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("file",
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_two-re.xml");
|
||||
checkConfig.addAttribute("file", getPath("import-control_two-re.xml"));
|
||||
final String[] expected = {
|
||||
"3:1: " + getCheckMessage(MSG_DISALLOWED, "java.awt.Image"),
|
||||
"4:1: " + getCheckMessage(MSG_DISALLOWED, "javax.swing.border.*"),
|
||||
"6:1: " + getCheckMessage(MSG_DISALLOWED, "java.awt.Button.ABORT"),
|
||||
};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -179,22 +177,19 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
@Test
|
||||
public void testUrl() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("url", getUriString("imports" + File.separator
|
||||
+ "import-control_one.xml"));
|
||||
checkConfig.addAttribute("url", getUriString("import-control_one.xml"));
|
||||
final String[] expected = {"5:1: " + getCheckMessage(MSG_DISALLOWED, "java.io.File")};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUrlBlank() throws Exception {
|
||||
final DefaultConfiguration checkConfig = createCheckConfig(ImportControlCheck.class);
|
||||
checkConfig.addAttribute("url", "");
|
||||
final String[] expected = {"1:40: " + getCheckMessage(MSG_MISSING_FILE)};
|
||||
final String[] expected = {"1:47: " + getCheckMessage(MSG_MISSING_FILE)};
|
||||
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -204,8 +199,7 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
|
||||
try {
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
fail("Test should fail if exception was not thrown");
|
||||
}
|
||||
catch (final CheckstyleException ex) {
|
||||
|
|
@ -221,8 +215,7 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
final String[] expected = ArrayUtils.EMPTY_STRING_ARRAY;
|
||||
|
||||
try {
|
||||
verify(checkConfig, getPath("imports" + File.separator
|
||||
+ "InputImportControl.java"), expected);
|
||||
verify(checkConfig, getPath("InputImportControl.java"), expected);
|
||||
fail("Test should fail if exception was not thrown");
|
||||
}
|
||||
catch (final CheckstyleException ex) {
|
||||
|
|
@ -243,5 +236,4 @@ public class ImportControlCheckTest extends BaseCheckTestSupport {
|
|||
private static String getInvocationTargetExceptionMessage(CheckstyleException ex) {
|
||||
return ((InvocationTargetException) ex.getCause().getCause()).getTargetException().getMessage();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,27 +34,28 @@ import org.xml.sax.helpers.AttributesImpl;
|
|||
import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
|
||||
|
||||
public class ImportControlLoaderTest {
|
||||
private static String getPath(String filename) {
|
||||
return "src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/" + filename;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoad() throws CheckstyleException {
|
||||
final PkgControl root =
|
||||
ImportControlLoader.load(new File(
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_complete.xml").toURI());
|
||||
ImportControlLoader.load(new File(getPath("import-control_complete.xml")).toURI());
|
||||
assertNotNull(root);
|
||||
}
|
||||
|
||||
@Test(expected = CheckstyleException.class)
|
||||
public void testWrongFormatURI() throws Exception {
|
||||
final PkgControl root =
|
||||
ImportControlLoader.load(
|
||||
new URI("aaa://src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_complete.xml"));
|
||||
ImportControlLoader.load(new URI("aaa://" + getPath("import-control_complete.xml")));
|
||||
assertNotNull(root);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtraElementInConfig() throws Exception {
|
||||
final PkgControl root =
|
||||
ImportControlLoader.load(new File(
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_WithNewElement.xml").toURI());
|
||||
ImportControlLoader.load(new File(getPath("import-control_WithNewElement.xml")).toURI());
|
||||
assertNotNull(root);
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +79,6 @@ public class ImportControlLoaderTest {
|
|||
| ClassNotFoundException | NoSuchMethodException | SecurityException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test(expected = InvocationTargetException.class)
|
||||
|
|
@ -92,14 +92,11 @@ public class ImportControlLoaderTest {
|
|||
"com.puppycrawl.tools.checkstyle.checks.imports.ImportControlLoader");
|
||||
Method privateMethod = clazz.getDeclaredMethod("load", InputSource.class, URI.class);
|
||||
privateMethod.setAccessible(true);
|
||||
privateMethod.invoke(null, source, new File(
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_complete.xml").toURI());
|
||||
privateMethod.invoke(null, source, new File(getPath("import-control_complete.xml")).toURI());
|
||||
}
|
||||
catch (IllegalAccessException | IllegalArgumentException
|
||||
| ClassNotFoundException | NoSuchMethodException | SecurityException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
//Moved to noncompilable because UT requires imports from the same package
|
||||
package java.util.concurrent;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.List; //warn, LEX, should be before "java.util.regex.Pattern"
|
||||
import java.util.regex.Matcher; //warn, LEX, should be before "java.util.regex.Pattern"
|
||||
import java.util.StringTokenizer; //warn, LEX, should be before "java.util.regex.Pattern"
|
||||
import java.util.*; //warn, LEX, should be before "java.util.regex.Pattern"
|
||||
import java.util.concurrent.AbstractExecutorService; //warn, ORDER, should be on SAME_PACKAGE, now NOT_ASSIGNED
|
||||
import java.util.concurrent.*; //warn, ORDER, should be on SAME_PACKAGE, now NOT_ASSIGNED
|
||||
|
||||
public class InputCustomImportOrderSamePackage2 {
|
||||
}
|
||||
/*
|
||||
test: testOnlySamePackage()
|
||||
configuration:
|
||||
checkConfig.addAttribute("customImportOrderRules", "SAME_PACKAGE(3)");
|
||||
checkConfig.addAttribute("sortImportsInGroupAlphabetically", "true");
|
||||
*/
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.imports.*;
|
||||
import com.puppycrawl.tools.checkstyle.checks.imports.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.*;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.imports.*;
|
||||
import com.puppycrawl.tools.checkstyle.checks.imports.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.*;
|
||||
|
|
@ -26,8 +26,8 @@ import static javax.swing.WindowConstants.*;
|
|||
import static javax.swing.WindowConstants.*;
|
||||
import static java.io.File.createTempFile;
|
||||
import static java.io.File.pathSeparator;
|
||||
import static com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass;
|
||||
import static com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.InnerClass.one;
|
||||
import static com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass;
|
||||
import static com.puppycrawl.tools.checkstyle.checks.imports.InputAvoidStaticImportNestedClass.InnerClass.one;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.Graphics2D;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.imports;
|
||||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
public class InputAvoidStaticImportNestedClass{
|
||||
public static Integer zero=0;
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.imports.*;
|
||||
import com.puppycrawl.tools.checkstyle.checks.imports.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.*;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package com.puppycrawl.tools.checkstyle.imports;
|
||||
package com.puppycrawl.tools.checkstyle.checks.imports;
|
||||
|
||||
import java.awt.Image;
|
||||
import javax.swing.border.*;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE import-control PUBLIC
|
||||
"-//Puppy Crawl//DTD Import Control 1.UT//EN"
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/imports/import-control_MODIFIED_FOR_UT.dtd">
|
||||
"src/test/resources/com/puppycrawl/tools/checkstyle/checks/imports/import-control_MODIFIED_FOR_UT.dtd">
|
||||
|
||||
<import-control pkg="com">
|
||||
<allow class="some.class"/>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
"-//Puppy Crawl//DTD Import Control 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
|
||||
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle">
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle.checks">
|
||||
<allow class="java\.awt.Image" regex="true"/>
|
||||
<allow class="java..*.Button.ABORT" regex="true"/>
|
||||
<allow class="java.(io|lui).File" local-only="true" regex="true"/>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
"-//Puppy Crawl//DTD Import Control 1.0//EN"
|
||||
"http://www.puppycrawl.com/dtds/import_control_1_0.dtd">
|
||||
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle">
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle.checks">
|
||||
<allow class="java.awt.Image"/>
|
||||
<allow class="java.awt.Button.ABORT"/>
|
||||
<allow class="java.io.File" local-only="true"/>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
"-//Puppy Crawl//DTD Import Control 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
|
||||
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle">
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle.checks">
|
||||
<allow class="java\.awt\.Image" regex="true"/>
|
||||
<allow class="java\..*\.File" local-only="true" regex="true"/>
|
||||
<subpackage name="imports">
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
"-//Puppy Crawl//DTD Import Control 1.0//EN"
|
||||
"http://www.puppycrawl.com/dtds/import_control_1_0.dtd">
|
||||
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle">
|
||||
<import-control pkg="com.puppycrawl.tools.checkstyle.checks">
|
||||
<allow class="java.awt.Image"/>
|
||||
<allow class="java.io.File" local-only="true"/>
|
||||
<subpackage name="imports">
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
package com.puppycrawl.tools.checkstyle.imports;
|
||||
|
||||
import static java.io.File.createTempFile;
|
||||
import static java.awt.Button.ABORT;
|
||||
import static javax.swing.WindowConstants.*;
|
||||
|
||||
import com.puppycrawl.tools.*;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.AbstractExecutorService;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import com.puppycrawl.tools.*;
|
||||
import com.*;
|
||||
|
||||
import com.google.common.*;
|
||||
import org.junit.*;
|
||||
|
||||
public class InputCustomImportOrder3 {
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
package com.puppycrawl.tools.checkstyle.imports;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.PhantomReference;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class InputCustomImportOrderTemp {
|
||||
}
|
||||
Loading…
Reference in New Issue