diff options
author | Andrei Selkin <andreyselkin@gmail.com> | 2015-11-04 14:10:56 +0300 |
---|---|---|
committer | Roman Ivanov <ivanov-jr@mail.ru> | 2015-11-04 06:00:32 -0800 |
commit | a66d414ae6254d11f5c6021cc804a56d250a3595 (patch) | |
tree | 06ba4827a5e67ec985c1762eee245f131de09cad /src/test/java | |
parent | 880ae00b7b8c90cf4ae0b66685f59b56adaf2aff (diff) | |
download | checkstyle-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.java | 44 |
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); + } } |