View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   // Copyright (C) 2001-2024 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.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
21  
22  import org.junit.jupiter.api.Test;
23  
24  import com.google.checkstyle.test.base.AbstractGoogleModuleTestSupport;
25  
26  public class HorizontalWhitespaceTest extends AbstractGoogleModuleTestSupport {
27  
28      @Override
29      protected String getPackageLocation() {
30          return "com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace";
31      }
32  
33      @Test
34      public void testWhitespaceAroundBasic() throws Exception {
35          verifyWithWholeConfig(getPath("InputWhitespaceAroundBasic.java"));
36      }
37  
38      @Test
39      public void testWhitespaceAroundBasicFormatted() throws Exception {
40          verifyWithWholeConfig(getPath("InputFormattedWhitespaceAroundBasic.java"));
41      }
42  
43      @Test
44      public void testWhitespaceAroundEmptyTypesCycles() throws Exception {
45          verifyWithWholeConfig(getPath("InputWhitespaceAroundEmptyTypesAndCycles.java"));
46      }
47  
48      @Test
49      public void testWhitespaceAroundEmptyTypesCyclesFormatted() throws Exception {
50          verifyWithWholeConfig(getPath("InputFormattedWhitespaceAroundEmptyTypesAndCycles.java"));
51      }
52  
53      @Test
54      public void testWhitespaceAfterBad() throws Exception {
55          verifyWithWholeConfig(getPath("InputWhitespaceAfterBad.java"));
56      }
57  
58      @Test
59      public void testWhitespaceAfterBadFormatted() throws Exception {
60          verifyWithWholeConfig(getPath("InputFormattedWhitespaceAfterBad.java"));
61      }
62  
63      @Test
64      public void testWhitespaceAfterGood() throws Exception {
65          verifyWithWholeConfig(getPath("InputWhitespaceAfterGood.java"));
66      }
67  
68      @Test
69      public void testWhitespaceAfterGoodFormatted() throws Exception {
70          verifyWithWholeConfig(getPath("InputFormattedWhitespaceAfterGood.java"));
71      }
72  
73      @Test
74      public void testParenPad() throws Exception {
75          verifyWithWholeConfig(getPath("InputParenPad.java"));
76      }
77  
78      @Test
79      public void testParenPadFormatted() throws Exception {
80          verifyWithWholeConfig(getPath("InputFormattedParenPad.java"));
81      }
82  
83      @Test
84      public void testNoWhitespaceBeforeEmptyForLoop() throws Exception {
85          verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeEmptyForLoop.java"));
86      }
87  
88      @Test
89      public void testNoWhitespaceBeforeEmptyForLoopFormatted() throws Exception {
90          verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeEmptyForLoop.java"));
91      }
92  
93      @Test
94      public void testNoWhitespaceBeforeColonOfLabel() throws Exception {
95          verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeColonOfLabel.java"));
96      }
97  
98      @Test
99      public void testNoWhitespaceBeforeColonOfLabelFormatted() throws Exception {
100         verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeColonOfLabel.java"));
101     }
102 
103     @Test
104     public void testNoWhitespaceBeforeAnnotations() throws Exception {
105         verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeAnnotations.java"));
106     }
107 
108     @Test
109     public void testNoWhitespaceBeforeAnnotationsFormatted() throws Exception {
110         verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeAnnotations.java"));
111     }
112 
113     @Test
114     public void testNoWhitespaceBeforeCaseDefaultColon() throws Exception {
115         verifyWithWholeConfig(getPath("InputNoWhitespaceBeforeCaseDefaultColon.java"));
116     }
117 
118     @Test
119     public void testNoWhitespaceBeforeCaseDefaultColonFormatted() throws Exception {
120         verifyWithWholeConfig(getPath("InputFormattedNoWhitespaceBeforeCaseDefaultColon.java"));
121     }
122 
123     @Test
124     public void testMethodParamPad() throws Exception {
125         verifyWithWholeConfig(getPath("InputMethodParamPad.java"));
126     }
127 
128     @Test
129     public void testMethodParamPadFormatted() throws Exception {
130         verifyWithWholeConfig(getPath("InputFormattedMethodParamPad.java"));
131     }
132 
133     @Test
134     public void testWhitespaceAroundGenerics() throws Exception {
135         verifyWithWholeConfig(getPath("InputWhitespaceAroundGenerics.java"));
136     }
137 
138     @Test
139     public void testWhitespaceAroundGenericsFormatted() throws Exception {
140         verifyWithWholeConfig(getPath("InputFormattedWhitespaceAroundGenerics.java"));
141     }
142 
143     @Test
144     public void testGenericWhitespace() throws Exception {
145         verifyWithWholeConfig(getPath("InputGenericWhitespace.java"));
146     }
147 
148     @Test
149     public void testGenericWhitespaceFormatted() throws Exception {
150         verifyWithWholeConfig(getPath("InputFormattedGenericWhitespace.java"));
151     }
152 
153     @Test
154     public void genericEndsTheLine() throws Exception {
155         verifyWithWholeConfig(getPath("InputGenericWhitespaceEndsTheLine.java"));
156     }
157 
158     @Test
159     public void genericEndsTheLineFormatted() throws Exception {
160         verifyWithWholeConfig(getPath("InputFormattedGenericWhitespaceEndsTheLine.java"));
161     }
162 
163     @Test
164     public void testWhitespaceAroundWhen() throws Exception {
165         verifyWithWholeConfig(getNonCompilablePath("InputWhitespaceAroundWhen.java"));
166     }
167 
168     @Test
169     public void testWhitespaceAroundWhenFormatted() throws Exception {
170         verifyWithWholeConfig(getNonCompilablePath("InputFormattedWhitespaceAroundWhen.java"));
171     }
172 }