use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class AvoidStarImportCheckTest method testDefaultOperation.
@Test
public void testDefaultOperation() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(AvoidStarImportCheck.class);
final String[] expected = { "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("InputAvoidStarImport.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class AvoidStaticImportCheckTest method testInnerClassMemberExcludesStar.
@Test
public void testInnerClassMemberExcludesStar() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(AvoidStaticImportCheck.class);
// should mask com.puppycrawl.tools.checkstyle.imports.InputAvoidStaticImportNestedClass.
// InnerClass.one
checkConfig.addAttribute("excludes", "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.checks.imports." + "InputAvoidStaticImportNestedClass.InnerClass") };
verify(checkConfig, getPath("InputAvoidStaticImport.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class AvoidStaticImportCheckTest method testStarExcludes.
@Test
public void testStarExcludes() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(AvoidStaticImportCheck.class);
checkConfig.addAttribute("excludes", "java.io.File.*,sun.net.ftpclient.FtpClient.*");
// allow the "java.io.File.*" AND "sun.net.ftpclient.FtpClient.*" star imports
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.checks.imports." + "InputAvoidStaticImportNestedClass.InnerClass"), "30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports." + "InputAvoidStaticImportNestedClass.InnerClass.one") };
verify(checkConfig, getPath("InputAvoidStaticImport.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class AvoidStaticImportCheckTest method testBogusMemberExcludes.
@Test
public void testBogusMemberExcludes() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(AvoidStaticImportCheck.class);
// should NOT mask anything
checkConfig.addAttribute("excludes", "java.io.File.listRoots.listRoots, javax.swing.WindowConstants, javax.swing.*," + "sun.net.ftpclient.FtpClient.*FtpClient, sun.net.ftpclient.FtpClientjunk," + " java.io.File.listRootsmorejunk");
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.checks.imports." + "InputAvoidStaticImportNestedClass.InnerClass"), "30: " + getCheckMessage(MSG_KEY, "com.puppycrawl.tools.checkstyle.checks.imports." + "InputAvoidStaticImportNestedClass.InnerClass.one") };
verify(checkConfig, getPath("InputAvoidStaticImport.java"), expected);
}
use of com.puppycrawl.tools.checkstyle.DefaultConfiguration in project checkstyle by checkstyle.
the class AtclauseOrderCheckTest method testCorrect.
@Test
public void testCorrect() throws Exception {
final DefaultConfiguration checkConfig = createCheckConfig(AtclauseOrderCheck.class);
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
verify(checkConfig, getPath("InputCorrectAtClauseOrder.java"), expected);
}
Aggregations