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.TypeBodyPaddingCheck.MSG_AFTER_LCURLY;
23 import static com.puppycrawl.tools.checkstyle.checks.whitespace.TypeBodyPaddingCheck.MSG_BEFORE_RCURLY;
24
25 import org.junit.jupiter.api.Test;
26
27 import com.puppycrawl.tools.checkstyle.AbstractExamplesModuleTestSupport;
28
29 public class TypeBodyPaddingExamplesTest extends AbstractExamplesModuleTestSupport {
30
31 @Override
32 public String getPackageLocation() {
33 return "com/puppycrawl/tools/checkstyle/checks/whitespace/typebodypadding";
34 }
35
36 @Test
37 public void testExample1() throws Exception {
38 final String[] expected = {
39 "13:16: " + getCheckMessage(MSG_AFTER_LCURLY),
40 "15:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
41 "54:14: " + getCheckMessage(MSG_AFTER_LCURLY),
42 "56:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
43 };
44
45 verifyWithInlineConfigParser(getPath("Example1.java"), expected);
46 }
47
48 @Test
49 public void testExample2() throws Exception {
50 final String[] expected = {
51 "15:16: " + getCheckMessage(MSG_AFTER_LCURLY),
52 "17:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
53 "26:19: " + getCheckMessage(MSG_AFTER_LCURLY),
54 "27:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
55 "56:14: " + getCheckMessage(MSG_AFTER_LCURLY),
56 "58:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
57 };
58
59 verifyWithInlineConfigParser(getPath("Example2.java"), expected);
60 }
61
62 @Test
63 public void testExample3() throws Exception {
64 final String[] expected = {
65 "17:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
66 "58:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
67 };
68 verifyWithInlineConfigParser(getPath("Example3.java"), expected);
69 }
70
71 @Test
72 public void testExample4() throws Exception {
73 final String[] expected = {
74 "15:16: " + getCheckMessage(MSG_AFTER_LCURLY),
75 "56:14: " + getCheckMessage(MSG_AFTER_LCURLY),
76 };
77 verifyWithInlineConfigParser(getPath("Example4.java"), expected);
78 }
79
80 @Test
81 public void testExample5() throws Exception {
82 final String[] expected = {
83 "15:16: " + getCheckMessage(MSG_AFTER_LCURLY),
84 "17:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
85 "37:16: " + getCheckMessage(MSG_AFTER_LCURLY),
86 "39:3: " + getCheckMessage(MSG_BEFORE_RCURLY),
87 "56:14: " + getCheckMessage(MSG_AFTER_LCURLY),
88 "58:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
89 };
90 verifyWithInlineConfigParser(getPath("Example5.java"), expected);
91 }
92
93 @Test
94 public void testExample6() throws Exception {
95 final String[] expected = {
96 "15:16: " + getCheckMessage(MSG_AFTER_LCURLY),
97 "17:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
98 "48:18: " + getCheckMessage(MSG_AFTER_LCURLY),
99 "50:5: " + getCheckMessage(MSG_BEFORE_RCURLY),
100 "56:14: " + getCheckMessage(MSG_AFTER_LCURLY),
101 "58:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
102 };
103 verifyWithInlineConfigParser(getPath("Example6.java"), expected);
104 }
105
106 @Test
107 public void testExample7() throws Exception {
108 final String[] expected = {
109 "57:14: " + getCheckMessage(MSG_AFTER_LCURLY),
110 "59:1: " + getCheckMessage(MSG_BEFORE_RCURLY),
111 };
112 verifyWithInlineConfigParser(getPath("Example7.java"), expected);
113 }
114
115 }