View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2026 the original author or authors.
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ///////////////////////////////////////////////////////////////////////////////////////////////
19  
20  package com.puppycrawl.tools.checkstyle.checks.coding;
21  
22  import static com.google.common.truth.Truth.assertWithMessage;
23  import static com.puppycrawl.tools.checkstyle.checks.coding.TextBlockGoogleStyleFormattingCheck.MSG_CLOSE_QUOTES_ERROR;
24  import static com.puppycrawl.tools.checkstyle.checks.coding.TextBlockGoogleStyleFormattingCheck.MSG_OPEN_QUOTES_ERROR;
25  import static com.puppycrawl.tools.checkstyle.checks.coding.TextBlockGoogleStyleFormattingCheck.MSG_TEXT_BLOCK_CONTENT;
26  import static com.puppycrawl.tools.checkstyle.checks.coding.TextBlockGoogleStyleFormattingCheck.MSG_VERTICALLY_UNALIGNED;
27  
28  import org.junit.jupiter.api.Test;
29  
30  import com.puppycrawl.tools.checkstyle.AbstractModuleTestSupport;
31  import com.puppycrawl.tools.checkstyle.api.TokenTypes;
32  import com.puppycrawl.tools.checkstyle.utils.CommonUtil;
33  
34  public class TextBlockGoogleStyleFormattingCheckTest extends AbstractModuleTestSupport {
35  
36      @Override
37      public String getPackageLocation() {
38          return "com/puppycrawl/tools/checkstyle/checks/coding/textblockgooglestyleformatting";
39      }
40  
41      @Test
42      public void testGetAcceptableTokens() {
43          final TextBlockGoogleStyleFormattingCheck check =
44              new TextBlockGoogleStyleFormattingCheck();
45  
46          final int[] acceptableTokens = {TokenTypes.TEXT_BLOCK_LITERAL_BEGIN};
47          assertWithMessage("Expected empty array")
48                  .that(check.getAcceptableTokens())
49                  .isEqualTo(acceptableTokens);
50      }
51  
52      @Test
53      public void testDefaultTextBlockFormat() throws Exception {
54          final String[] expected = {
55              "14:37: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
56              "14:40: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
57              "16:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
58              "26:33: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
59              "26:36: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
60              "28:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
61              "39:36: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
62              "39:39: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
63              "41:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
64              "45:17: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
65              "45:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
66              "48:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
67              "52:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
68              "52:19: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
69              "54:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
70              "60:32: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
71              "60:32: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
72              "68:42: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
73              "68:42: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
74              "75:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
75              "89:29: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
76              "89:32: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
77              "90:29: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
78              "102:17: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
79              "102:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
80              "104:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
81              "104:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
82              "106:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
83          };
84  
85          verifyWithInlineConfigParser(
86              getPath("InputTextBlockGoogleStyleFormatting.java"), expected);
87      }
88  
89      @Test
90      public void testDefaultTextBlockFormat1() throws Exception {
91          final String[] expected = {
92              "18:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
93              "18:22: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
94              "20:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
95              "20:18: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
96              "20:21: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
97              "22:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
98              "30:35: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
99              "30:35: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
100             "46:15: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
101             "51:15: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
102             "51:18: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
103             "53:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
104         };
105 
106         verifyWithInlineConfigParser(
107                 getPath("InputTextBlockGoogleStyleFormatting1.java"), expected);
108     }
109 
110     @Test
111     public void testDefaultTextBlockFormat2() throws Exception {
112         final String[] expected = {
113             "13:37: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
114             "13:40: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
115             "14:14: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
116             "14:14: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
117             "22:32: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
118             "22:32: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
119             "29:33: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
120             "29:36: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
121             "30:38: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
122             "30:38: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
123             "39:34: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
124             "39:34: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
125             "46:36: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
126             "46:39: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
127             "47:31: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
128             "47:31: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
129             "55:17: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
130             "55:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
131             "57:42: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
132             "57:42: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
133             "63:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
134             "63:19: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
135             "64:32: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
136             "64:32: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
137             "74:32: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
138             "74:32: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
139             "82:42: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
140             "82:42: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
141             "89:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
142             "89:19: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
143             "90:41: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
144             "90:41: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
145             "98:41: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
146             "98:41: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
147             "105:24: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
148             "105:24: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
149         };
150 
151         verifyWithInlineConfigParser(
152             getPath("InputTextBlockGoogleStyleFormatting2.java"), expected);
153     }
154 
155     @Test
156     public void testDefaultTextBlockFormat3() throws Exception {
157         final String[] expected = {
158             "20:17: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
159             "20:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
160             "22:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
161             "22:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
162             "22:22: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
163             "23:24: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
164             "23:24: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
165             "25:26: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
166             "25:26: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
167             "37:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
168             "37:22: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
169             "38:24: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
170             "38:24: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
171             "38:29: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
172             "38:32: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
173             "39:26: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
174             "39:26: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
175             "47:35: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
176             "47:35: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
177             "56:24: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
178             "56:24: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
179             "63:27: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
180             "63:27: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
181             "70:15: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
182             "70:18: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
183             "71:22: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
184             "71:22: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
185             "80:22: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
186             "80:22: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
187         };
188 
189         verifyWithInlineConfigParser(
190             getPath("InputTextBlockGoogleStyleFormatting3.java"), expected);
191     }
192 
193     @Test
194     public void testDefaultTextBlockFormat4() throws Exception {
195         final String[] expected = {
196             "17:25: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
197             "27:29: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
198             "27:32: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
199             "28:36: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
200             "28:36: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
201             "28:51: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
202             "28:54: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
203             "30:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
204             "37:20: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
205             "37:23: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
206             "40:44: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
207             "40:44: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
208             "51:17: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
209             "51:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
210             "54:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
211             "64:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
212             "64:19: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
213             "67:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
214             "70:15: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
215             "70:18: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
216             "77:12: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
217             "83:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
218             "83:19: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
219             "86:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
220             "99:16: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
221             "99:19: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
222             "101:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
223             "103:12: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
224             "112:12: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
225         };
226         verifyWithInlineConfigParser(
227             getPath("InputTextBlockGoogleStyleFormatting4.java"), expected);
228     }
229 
230     @Test
231     public void testDefaultTextBlockFormat5() throws Exception {
232         final String[] expected = {
233             "17:48: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
234             "17:45: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
235             "19:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
236             "26:44: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
237             "26:47: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
238             "28:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
239             "34:51: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
240             "34:54: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
241             "36:26: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
242             "42:24: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
243             "42:27: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
244             "46:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
245             "51:23: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
246             "51:26: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
247             "53:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
248             "58:20: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
249             "58:23: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
250             "60:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
251             "68:48: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
252             "68:51: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
253             "71:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
254             "81:28: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
255             "81:31: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
256             "83:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
257             "83:15: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
258             "83:18: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
259             "85:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
260         };
261 
262         verifyWithInlineConfigParser(
263             getPath("InputTextBlockGoogleStyleFormatting5.java"),
264                 expected);
265     }
266 
267     @Test
268     public void testTextBlockGoogleStyleFormattingWithTabs() throws Exception {
269         final String[] expected = {
270             "15:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
271             "18:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
272             "25:24: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
273             "25:27: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
274             "28:33: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
275             "33:21: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
276             "41:66: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
277             "41:69: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
278             "44:65: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
279         };
280 
281         verifyWithInlineConfigParser(
282             getPath("InputTextBlockGoogleStyleFormattingWithTabs.java"),
283                 expected);
284     }
285 
286     @Test
287     public void testTextBlockFormatNotVerticallyAligned() throws Exception {
288         final String[] expected = {
289             "28:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
290             "33:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
291             "39:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
292             "44:1: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
293             "51:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
294             "69:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
295             "99:13: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
296             "102:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
297             "111:12: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
298         };
299 
300         verifyWithInlineConfigParser(
301             getPath("InputTextBlockGoogleStyleFormattingNotVerticallyAligned.java"),
302                 expected);
303     }
304 
305     @Test
306     public void testDefaultTextBlockFormatWithIf() throws Exception {
307         final String[] expected = {
308             "17:18: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
309             "17:21: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
310             "18:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
311             "25:13: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
312             "26:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
313             "26:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
314             "26:24: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
315             "26:27: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
316             "27:19: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
317             "27:19: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
318             "39:20: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
319             "39:23: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
320             "40:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
321             "40:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
322             "40:24: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
323             "40:27: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
324             "41:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
325             "41:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
326             "57:18: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
327             "57:21: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
328             "58:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
329             "58:24: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
330             "58:27: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
331             "59:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
332             "59:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
333             "59:24: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
334             "59:27: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
335             "60:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
336             "60:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
337             "72:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
338             "72:22: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
339             "81:38: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
340             "81:41: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
341             "82:20: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
342             "82:20: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
343             "73:20: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
344             "73:20: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
345             "90:33: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
346             "90:36: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
347             "91:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
348             "91:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
349             "99:22: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
350             "99:25: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
351             "100:18: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
352             "100:18: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
353             "108:21: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
354             "108:24: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
355             "109:19: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
356             "109:19: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
357             "110:22: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
358             "111:27: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
359             "111:27: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
360         };
361 
362         verifyWithInlineConfigParser(
363             getPath("InputTextBlockGoogleStyleFormatting6.java"), expected);
364     }
365 
366     @Test
367     public void testDefaultTextBlockFormatWithNewKeyword() throws Exception {
368         final String[] expected = {
369             "13:45: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
370             "13:42: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
371             "15:33: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
372             "23:31: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
373             "23:34: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
374             "25:25: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
375             "28:55: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
376             "28:58: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
377             "30:25: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
378             "39:70: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
379             "39:70: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
380             "49:21: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
381             "51:24: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
382             "64:36: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
383             "64:39: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
384             "66:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
385             "70:23: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
386             "70:26: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
387             "72:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
388             "79:25: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
389             "105:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
390             "107:21: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
391         };
392         verifyWithInlineConfigParser(
393                 getPath("InputTextBlockGoogleStyleFormatting7.java"), expected);
394     }
395 
396     @Test
397     public void testDefaultTextBlockFormatInCtor() throws Exception {
398         final String[] expected = {
399             "24:66: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
400             "24:66: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
401             "39:23: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
402             "39:26: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
403             "41:17: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
404             "46:20: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
405             "53:29: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
406             "55:14: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
407         };
408         verifyWithInlineConfigParser(
409                 getPath("InputTextBlockGoogleStyleFormatting8.java"), expected);
410     }
411 
412     @Test
413     public void testDefaultTextBlockFormatInAnnotations() throws Exception {
414         final String[] expected = {
415             "13:22: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
416             "13:25: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
417             "14:19: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
418             "14:19: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
419             "22:22: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
420             "22:25: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
421             "23:15: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
422             "23:15: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
423             "33:22: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
424             "33:25: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
425             "35:9: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
426         };
427         verifyWithInlineConfigParser(
428                 getPath("InputTextBlockGoogleStyleFormatting9.java"), expected);
429     }
430 
431     @Test
432     public void testDefaultTextBlockFormatIndentationOfContent() throws Exception {
433         final String[] expected = {
434             "13:16: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
435             "27:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
436             "49:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
437             "50:17: " + getCheckMessage(MSG_CLOSE_QUOTES_ERROR),
438         };
439         verifyWithInlineConfigParser(
440                 getPath("InputTextBlockGoogleStyleFormatting10.java"), expected);
441     }
442 
443     @Test
444     public void testDefaultTextBlockFormatAnnotations() throws Exception {
445         final String[] expected = {
446             "60:27: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
447             "60:30: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
448             "68:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
449             "68:22: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
450             "70:1: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
451         };
452         verifyWithInlineConfigParser(
453                 getPath("InputTextBlockGoogleStyleFormattingAnnotations.java"), expected);
454     }
455 
456     @Test
457     public void testDefaultTextBlockFormat6() throws Exception {
458         final String[] expected = {
459             "31:16: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
460             "48:20: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
461         };
462         verifyWithInlineConfigParser(
463                 getPath("InputTextBlockGoogleStyleFormatting11.java"), expected);
464     }
465 
466     @Test
467     public void testTextBlockInAnnotationType() throws Exception {
468         final String[] expected = CommonUtil.EMPTY_STRING_ARRAY;
469         verifyWithInlineConfigParser(
470                 getPath("InputTextBlockGoogleStyleFormattingType.java"), expected);
471     }
472 
473     @Test
474     public void testTextBlockAsArguments() throws Exception {
475         final String[] expected = {
476             "14:13: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
477             "16:18: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
478             "25:18: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
479             "27:23: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
480             "35:21: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
481         };
482         verifyWithInlineConfigParser(
483                 getPath("InputTextBlockGoogleStyleFormattingTextBlockAsArgument.java"),
484                 expected
485         );
486     }
487 
488     @Test
489     public void testDefaultTestBlockFormatWithTernary() throws Exception {
490         final String[] expected = {
491             "17:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
492             "20:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
493             "38:27: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
494             "38:30: " + getCheckMessage(MSG_TEXT_BLOCK_CONTENT),
495             "40:19: " + getCheckMessage(MSG_VERTICALLY_UNALIGNED),
496             "41:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
497             "60:19: " + getCheckMessage(MSG_OPEN_QUOTES_ERROR),
498         };
499         verifyWithInlineConfigParser(
500                 getPath("InputTextBlockGoogleStyleFormattingTernary.java"), expected);
501     }
502 
503 }