aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorAndrei Selkin <andreyselkin@gmail.com>2015-11-04 14:10:56 +0300
committerRoman Ivanov <ivanov-jr@mail.ru>2015-11-04 06:00:32 -0800
commita66d414ae6254d11f5c6021cc804a56d250a3595 (patch)
tree06ba4827a5e67ec985c1762eee245f131de09cad /src/test/java
parent880ae00b7b8c90cf4ae0b66685f59b56adaf2aff (diff)
downloadcheckstyle-a66d414ae6254d11f5c6021cc804a56d250a3595.tar.gz
Issue #2480: Fix skipping validation for non empty classes when allowEmptyTypes is true
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java
index 4305a37c0..89d57b7c6 100644
--- a/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java
+++ b/src/test/java/com/puppycrawl/tools/checkstyle/checks/whitespace/WhitespaceAroundCheckTest.java
@@ -286,4 +286,48 @@ public class WhitespaceAroundCheckTest
};
assertArrayEquals(expected, actual);
}
+
+ @Test
+ public void testAllowEmptyTypesIsSetToFalseAndNonEmptyClasses() throws Exception {
+ checkConfig.addAttribute("allowEmptyTypes", "false");
+ final String[] expected = {
+ "6:52: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "10:20: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "14:32: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "18:18: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "20:24: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "20:25: " + getCheckMessage(WS_NOT_FOLLOWED, "{"),
+ "20:31: " + getCheckMessage(WS_NOT_PRECEDED, "}"),
+ "22:31: " + getCheckMessage(WS_NOT_FOLLOWED, "}"),
+ "24:18: " + getCheckMessage(WS_NOT_FOLLOWED, "{"),
+ "24:18: " + getCheckMessage(WS_NOT_PRECEDED, "}"),
+ "26:69: " + getCheckMessage(WS_NOT_FOLLOWED, "{"),
+ "26:69: " + getCheckMessage(WS_NOT_PRECEDED, "}"),
+ "28:24: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "31:13: " + getCheckMessage(WS_NOT_FOLLOWED, "{"),
+ "31:13: " + getCheckMessage(WS_NOT_PRECEDED, "}"),
+ };
+ verify(checkConfig, getPath("InputAllowEmptyTypesAndNonEmptyClasses.java"),
+ expected);
+ }
+
+ @Test
+ public void testAllowEmptyTypesIsSetToTrueAndNonEmptyClasses() throws Exception {
+ checkConfig.addAttribute("allowEmptyTypes", "true");
+ final String[] expected = {
+ "6:52: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "10:20: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "14:32: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "18:18: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "20:24: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "20:25: " + getCheckMessage(WS_NOT_FOLLOWED, "{"),
+ "20:31: " + getCheckMessage(WS_NOT_PRECEDED, "}"),
+ "22:31: " + getCheckMessage(WS_NOT_FOLLOWED, "}"),
+ "28:24: " + getCheckMessage(WS_NOT_PRECEDED, "{"),
+ "31:13: " + getCheckMessage(WS_NOT_FOLLOWED, "{"),
+ "31:13: " + getCheckMessage(WS_NOT_PRECEDED, "}"),
+ };
+ verify(checkConfig, getPath("InputAllowEmptyTypesAndNonEmptyClasses.java"),
+ expected);
+ }
}