1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.google.checkstyle.test.chapter4formatting.rule4841indentation;
21
22 import org.junit.jupiter.api.Test;
23
24 import com.google.checkstyle.test.base.AbstractIndentationTestSupport;
25
26 public class IndentationTest extends AbstractIndentationTestSupport {
27
28 @Override
29 protected String getPackageLocation() {
30 return "com/google/checkstyle/test/chapter4formatting/rule4841indentation";
31 }
32
33 @Test
34 public void testCorrectClass() throws Exception {
35 verifyWithWholeConfig(getPath("InputIndentationCorrectClass.java"));
36 }
37
38 @Test
39 public void testCorrectField() throws Exception {
40 verifyWithWholeConfig(getPath("InputIndentationCorrectFieldAndParameter.java"));
41 }
42
43 @Test
44 public void testCorrectFor() throws Exception {
45 verifyWithWholeConfig(getPath("InputIndentationCorrectForAndParameter.java"));
46 }
47
48 @Test
49 public void testCorrectIf() throws Exception {
50 verifyWithWholeConfig(getPath("InputIndentationCorrectIfAndParameter.java"));
51 }
52
53 @Test
54 public void testCorrectNewKeyword() throws Exception {
55 verifyWithWholeConfig(getPath("InputIndentationCorrectNewChildren.java"));
56 }
57
58 @Test
59 public void testCorrect() throws Exception {
60 verifyWithWholeConfig(getPath("InputIndentationCorrect.java"));
61 }
62
63 @Test
64 public void testCorrectReturn() throws Exception {
65 verifyWithWholeConfig(getPath("InputIndentationCorrectReturnAndParameter.java"));
66 }
67
68 @Test
69 public void testCorrectWhile() throws Exception {
70 verifyWithWholeConfig(getPath("InputIndentationCorrectWhileDoWhileAndParameter.java"));
71 }
72
73 @Test
74 public void testCorrectChained() throws Exception {
75 verifyWithWholeConfig(getPath("InputClassWithChainedMethodsCorrect.java"));
76 }
77
78 @Test
79 public void testWarnChained() throws Exception {
80 verifyWithWholeConfig(getPath("InputClassWithChainedMethods.java"));
81 }
82
83 @Test
84 public void testWarnChainedFormatted() throws Exception {
85 verifyWithWholeConfig(getPath("InputFormattedClassWithChainedMethods.java"));
86 }
87
88 @Test
89 public void testCorrectAnnotationArrayInit() throws Exception {
90 verifyWithWholeConfig(getPath("InputIndentationCorrectAnnotationArrayInit.java"));
91 }
92
93 @Test
94 public void testFastMatcher() throws Exception {
95 verifyWithWholeConfig(getPath("InputFastMatcher.java"));
96 }
97
98 @Test
99 public void testSwitchOnTheStartOfTheLine() throws Exception {
100 verifyWithWholeConfig(getPath("InputSwitchOnStartOfTheLine.java"));
101 }
102
103 @Test
104 public void testFormattedSwitchOnTheStartOfTheLine() throws Exception {
105 verifyWithWholeConfig(getPath("InputFormattedSwitchOnStartOfTheLine.java"));
106 }
107
108 @Test
109 public void testSingleSwitchStatementWithoutCurly() throws Exception {
110 verifyWithWholeConfig(getPath("InputSingleSwitchStatementWithoutCurly.java"));
111 }
112
113 @Test
114 public void testFormattedSingleSwitchStatementWithoutCurly() throws Exception {
115 verifyWithWholeConfig(
116 getPath("InputFormattedSingleSwitchStatementWithoutCurly.java"));
117 }
118
119 @Test
120 public void testSwitchWrappingIndentation() throws Exception {
121 verifyWithWholeConfig(getPath("InputSwitchWrappingIndentation.java"));
122 }
123
124 @Test
125 public void testFormattedSwitchWrappingIndentation() throws Exception {
126 verifyWithWholeConfig(
127 getPath("InputFormattedSwitchWrappingIndentation.java"));
128 }
129
130 @Test
131 public void testMultilineParameters() throws Exception {
132 verifyWithWholeConfig(getPath("InputCatchParametersOnNewLine.java"));
133 }
134
135 @Test
136 public void testFormattedMultilineParameters() throws Exception {
137 verifyWithWholeConfig(
138 getPath("InputFormattedCatchParametersOnNewLine.java"));
139 }
140
141 @Test
142 public void testNewKeywordChildren() throws Exception {
143 verifyWithWholeConfig(getPath("InputNewKeywordChildren.java"));
144 }
145
146 @Test
147 public void testFormattedNewKeywordChildren() throws Exception {
148 verifyWithWholeConfig(getPath("InputFormattedNewKeywordChildren.java"));
149 }
150
151 @Test
152 public void testLambdaChild() throws Exception {
153 verifyWithWholeConfig(getPath("InputLambdaChild.java"));
154 }
155
156 @Test
157 public void testFormattedLambdaChild() throws Exception {
158 verifyWithWholeConfig(getPath("InputFormattedLambdaChild.java"));
159 }
160
161 @Test
162 public void testLambdaAndChildOnTheSameLine() throws Exception {
163 verifyWithWholeConfig(getPath("InputLambdaAndChildOnTheSameLine.java"));
164 }
165
166 @Test
167 public void testFormattedLambdaAndChildOnTheSameLine() throws Exception {
168 verifyWithWholeConfig(
169 getPath("InputFormattedLambdaAndChildOnTheSameLine.java"));
170 }
171
172 @Test
173 public void testAnnotationArrayInitMultiline1() throws Exception {
174 verifyWithWholeConfig(getPath("InputAnnotationArrayInitMultiline.java"));
175 }
176
177 @Test
178 public void testFormattedAnnotationArrayInitMultiline1() throws Exception {
179 verifyWithWholeConfig(getPath("InputFormattedAnnotationArrayInitMultiline.java"));
180 }
181
182 @Test
183 public void testAnnotationArrayInitMultiline2() throws Exception {
184 verifyWithWholeConfig(getPath("InputAnnotationArrayInitMultiline2.java"));
185 }
186
187 @Test
188 public void testFormattedAnnotationArrayInitMultiline2() throws Exception {
189 verifyWithWholeConfig(getPath("InputFormattedAnnotationArrayInitMultiline2.java"));
190 }
191
192 @Test
193 public void testLineBreakAfterLeftCurlyOfBlockInSwitch() throws Exception {
194 verifyWithWholeConfig(getPath("InputLineBreakAfterLeftCurlyOfBlockInSwitch.java"));
195 }
196
197 @Test
198 public void testFormattedLineBreakAfterLeftCurlyOfBlockInSwitch() throws Exception {
199 verifyWithWholeConfig(
200 getPath("InputFormattedLineBreakAfterLeftCurlyOfBlockInSwitch.java"));
201 }
202 }