1 package com.google.checkstyle.test.chapter4formatting.rule44columnlimit;
2
3
4
5
6 import com.google.checkstyle.test.chapter3filestructure.toolongpackagetotestcoveragegooglesjavastylerule.PackageStatementTest;
7 import java.io.IOException;
8
9 final class InputFormattedColumnLimit {
10
11
12
13
14 PackageStatementTest pckgStmt = new PackageStatementTest();
15
16 private int[] testing =
17 new int[] {
18 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
19 26, 27
20 };
21
22
23
24
25
26
27
28
29
30
31 int test1(int badFormat1, int badFormat2, final int badFormat3) throws java.lang.Exception {
32 return 0;
33 }
34
35
36
37
38
39 String https = "200 OK";
40
41
42
43
44
45 String http = "200 OK";
46
47
48
49 int ftp = 0;
50
51
52
53
54 int invalidHref = 88;
55
56
57
58 int validHref = 54;
59
60
61
62
63 int validHrefWithWhiteSpaces = 54;
64
65
66 int
67 aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaabllee1 =
68 99;
69
70
71 int
72 aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaabllee2 =
73 99;
74
75
76
77
78 void
79 longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd1() {}
80
81
82 void
83 longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd2() {}
84
85
86
87 final boolean isValid = true;
88 final boolean isValid2 = true;
89 final boolean isValid3 = true;
90 final boolean isValid4 = true;
91 final boolean isValid5 = true;
92
93 void testingNestedIf1() {
94 if (isValid) {
95 if (isValid2) {
96 if (isValid3) {
97 if (isValid4) {
98 if (isValid5) {
99
100 longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd1();
101 }
102 }
103 }
104 }
105 }
106 }
107
108 void testingNestedIf2() {
109 if (isValid) {
110 if (isValid2) {
111 if (isValid3) {
112 if (isValid4) {
113 if (isValid5) {
114
115 longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd2();
116 }
117 }
118 }
119 }
120 }
121 }
122
123
124 void testingParametersNames1(
125 int
126 areallllllyyyyyyyyyyyyyyyyyylonnnnggggggggggnameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,
127 int anotherlongnameblahblahblah) {}
128
129
130 void testingParametersNames2(
131 int
132 areallllllyyyyyyyyyyyyyyyyyylonnnnggggggggggnameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,
133 int anotherlongnameblahblahblah) {}
134
135
136
137 InputColumnLimit inputColumnLimit1 =
138 (InputColumnLimit)
139 ((Object)
140 new com.google.checkstyle.test.chapter4formatting.rule44columnlimit
141 .InputColumnLimit());
142
143
144 InputColumnLimit inputColumnLimit2 =
145 (InputColumnLimit)
146 ((Object)
147 new com.google.checkstyle.test.chapter4formatting.rule44columnlimit
148 .InputColumnLimit());
149
150
151
152
153 void testing1() {
154 try {
155 throwExceptionBasedOnCondition1();
156 } catch (IOException
157 | NullPointerException
158 | ArrayIndexOutOfBoundsException
159 | ClassNotFoundException ex) {
160 System.out.println(ex.getMessage());
161 }
162 }
163
164 void testing2() {
165 try {
166 throwExceptionBasedOnCondition2();
167
168 } catch (IOException
169 | NullPointerException
170 | ArrayIndexOutOfBoundsException
171 | ClassNotFoundException ex) {
172
173 System.out.println(ex.getMessage());
174 }
175 }
176
177 void throwExceptionBasedOnCondition1()
178 throws IOException,
179 NullPointerException,
180 ArrayIndexOutOfBoundsException,
181 ClassNotFoundException {
182 int condition = new java.util.Random().nextInt(3);
183 switch (condition) {
184 case 0:
185 throw new IOException("Test IOException");
186 case 1:
187 throw new NullPointerException("Test NullPointerException");
188 case 2:
189 throw new ArrayIndexOutOfBoundsException("Test ArrayIndexOutOfBoundsException");
190 case 3:
191 throw new ClassNotFoundException("Test ClassNotFoundException");
192 default:
193 }
194 }
195
196
197 void throwExceptionBasedOnCondition2()
198 throws IOException,
199 NullPointerException,
200 ArrayIndexOutOfBoundsException,
201 ClassNotFoundException {
202
203
204 int condition = new java.util.Random().nextInt(3);
205 switch (condition) {
206 case 0:
207 throw new IOException("Test IOException");
208 case 1:
209 throw new NullPointerException("Test NullPointerException");
210 case 2:
211 throw new ArrayIndexOutOfBoundsException("Test ArrayIndexOutOfBoundsException");
212 case 3:
213 throw new ClassNotFoundException("Test ClassNotFoundException");
214 default:
215 }
216 }
217
218
219 class LonggggggggggggggggggggggggggggClassssssssssssssssssssssssssNameeeeeeeeeeeeeeSoooooBoooooorrriinngggg1 {
220
221 void
222 longggggggggggggggggggggmethooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddddddddddddddddddd(
223 int x, int y) {}
224
225
226
227
228
229 int
230 aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaablleeeeeeeeeeee =
231 99;
232
233 }
234
235
236 class LonggggggggggggggggggggggggggggClassssssssssssssssssssssssssNameeeeeeeeeeeeeeSoooooBoooooorrriinngggg2 {
237
238 void
239 longggggggggggggggggggggmethooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddddddddddddddddddd(
240 int x, int y) {}
241
242
243 int
244 aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaablleeeeeeeeeeee =
245 99;
246 }
247 }