diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckTest.java index b96a8b5e1851..2a7333374b92 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/imports/AvoidStarImportCheckTest.java @@ -95,6 +95,22 @@ public void testAllowStaticMemberImports() throws Exception { verify(checkConfig, getPath("InputAvoidStarImportDefault.java"), expected2); } + @Test + public void testDenyStaticMemberImports() throws Exception { + final DefaultConfiguration checkConfig = createModuleConfig(AvoidStarImportCheck.class); + checkConfig.addAttribute("allowStaticMemberImports", "false"); + // deny all static star imports + final String[] expected2 = { + "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("InputAvoidStarImportDefault.java"), expected2); + } + @Test public void testGetAcceptableTokens() { final AvoidStarImportCheck testCheckObject =