1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.puppycrawl.tools.checkstyle.checks.whitespace;
21
22 import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.MSG_WS_FOLLOWED;
23 import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.MSG_WS_NOT_FOLLOWED;
24 import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.MSG_WS_NOT_PRECEDED;
25 import static com.puppycrawl.tools.checkstyle.checks.whitespace.AbstractParenPadCheck.MSG_WS_PRECEDED;
26
27 import org.junit.jupiter.api.Test;
28
29 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
30
31 public class TypecastParenPadExamplesTest extends AbstractExamplesModuleTestSupport {
32
33 @Override
34 public String getPackageLocation() {
35 return "com/puppycrawl/tools/checkstyle/checks/whitespace/typecastparenpad";
36 }
37
38 @Test
39 public void testExample1() throws Exception {
40 final String[] expected = {
41 "17:11: " + getCheckMessage(MSG_WS_FOLLOWED, "("),
42 "17:17: " + getCheckMessage(MSG_WS_PRECEDED, ")"),
43 "19:16: " + getCheckMessage(MSG_WS_PRECEDED, ")"),
44 "21:11: " + getCheckMessage(MSG_WS_FOLLOWED, "("),
45 "29:11: " + getCheckMessage(MSG_WS_FOLLOWED, "("),
46 "29:17: " + getCheckMessage(MSG_WS_PRECEDED, ")"),
47 };
48
49 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
50 }
51
52 @Test
53 public void testExample2() throws Exception {
54 final String[] expected = {
55 "21:11: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "("),
56 "23:16: " + getCheckMessage(MSG_WS_NOT_PRECEDED, ")"),
57 "25:11: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "("),
58 "25:15: " + getCheckMessage(MSG_WS_NOT_PRECEDED, ")"),
59 "29:11: " + getCheckMessage(MSG_WS_NOT_FOLLOWED, "("),
60 "29:15: " + getCheckMessage(MSG_WS_NOT_PRECEDED, ")"),
61 };
62
63 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
64 }
65
66 }