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.MethodParamPadCheck.MSG_LINE_PREVIOUS;
23 import static com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck.MSG_WS_NOT_PRECEDED;
24 import static com.puppycrawl.tools.checkstyle.checks.whitespace.MethodParamPadCheck.MSG_WS_PRECEDED;
25
26 import org.junit.jupiter.api.Test;
27
28 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
29
30 public class MethodParamPadExamplesTest extends AbstractExamplesModuleTestSupport {
31
32 @Override
33 public String getPackageLocation() {
34 return "com/puppycrawl/tools/checkstyle/checks/whitespace/methodparampad";
35 }
36
37 @Test
38 public void testExample1() throws Exception {
39 final String[] expected = {
40 "19:19: " + getCheckMessage(MSG_WS_PRECEDED, "("),
41 "20:11: " + getCheckMessage(MSG_WS_PRECEDED, "("),
42 "26:3: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
43 };
44
45 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
46 }
47
48 @Test
49 public void testExample2() throws Exception {
50 final String[] expected = {
51 "27:21: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
52 };
53
54 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
55 }
56
57 @Test
58 public void testExample3() throws Exception {
59 final String[] expected = {
60 "15:18: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
61 "16:10: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
62 "23:21: " + getCheckMessage(MSG_WS_NOT_PRECEDED, "("),
63 "26:3: " + getCheckMessage(MSG_LINE_PREVIOUS, "("),
64 };
65
66 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
67 }
68
69 @Test
70 public void testExample4() throws Exception {
71 final String[] expected = {
72 "19:19: " + getCheckMessage(MSG_WS_PRECEDED, "("),
73 "20:11: " + getCheckMessage(MSG_WS_PRECEDED, "("),
74 };
75
76 verifyWithInlineConfigParser(getPath("Example4.java"), expected);
77 }
78
79 }