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 InputColumnLimit {
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, 26, 27
19
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 int ftp = 0;
49
50
51
52 int invalidHref = 88;
53
54
55 int validHref = 54;
56
57
58 int validHrefWithWhiteSpaces = 54;
59
60
61 int aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaabllee1 = 99;
62
63
64 int aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaabllee2 = 99;
65
66
67
68 void longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd1() {}
69
70
71 void longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd2() {}
72
73
74 final boolean isValid = true;
75 final boolean isValid2 = true;
76 final boolean isValid3 = true;
77 final boolean isValid4 = true;
78 final boolean isValid5 = true;
79
80 void testingNestedIf1() {
81 if (isValid) {
82 if (isValid2) {
83 if (isValid3) {
84 if (isValid4) {
85 if (isValid5) {
86
87 longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd1();
88 }
89 }
90 }
91 }
92 }
93 }
94
95 void testingNestedIf2() {
96 if (isValid) {
97 if (isValid2) {
98 if (isValid3) {
99 if (isValid4) {
100 if (isValid5) {
101
102 longggggggggggggggggggggmethoooooooooooooooooooooodddddddddddddddddddddddddddddddddddddddddddddd2();
103 }
104 }
105 }
106 }
107 }
108 }
109
110
111 void testingParametersNames1(int areallllllyyyyyyyyyyyyyyyyyylonnnnggggggggggnameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, int anotherlongnameblahblahblah) {}
112
113
114 void testingParametersNames2(int areallllllyyyyyyyyyyyyyyyyyylonnnnggggggggggnameeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, int anotherlongnameblahblahblah) {}
115
116
117
118 InputColumnLimit inputColumnLimit1 = (InputColumnLimit) ((Object) new com.google.checkstyle.test.chapter4formatting.rule44columnlimit.InputColumnLimit());
119
120
121 InputColumnLimit inputColumnLimit2 = (InputColumnLimit) ((Object) new com.google.checkstyle.test.chapter4formatting.rule44columnlimit.InputColumnLimit());
122
123
124
125 void testing1() {
126 try {
127 throwExceptionBasedOnCondition1();
128
129 } catch (IOException | NullPointerException | ArrayIndexOutOfBoundsException | ClassNotFoundException ex) {
130 System.out.println(ex.getMessage());
131 }
132 }
133
134 void testing2() {
135 try {
136 throwExceptionBasedOnCondition2();
137
138 } catch (IOException | NullPointerException | ArrayIndexOutOfBoundsException | ClassNotFoundException ex) {
139
140 System.out.println(ex.getMessage());
141 }
142 }
143
144
145 void throwExceptionBasedOnCondition1()
146 throws IOException, NullPointerException, ArrayIndexOutOfBoundsException, ClassNotFoundException {
147 int condition = new java.util.Random().nextInt(3);
148 switch (condition) {
149 case 0:
150 throw new IOException("Test IOException");
151 case 1:
152 throw new NullPointerException("Test NullPointerException");
153 case 2:
154 throw new ArrayIndexOutOfBoundsException("Test ArrayIndexOutOfBoundsException");
155 case 3:
156 throw new ClassNotFoundException("Test ClassNotFoundException");
157 default:
158 }
159 }
160
161
162 void throwExceptionBasedOnCondition2()
163 throws IOException, NullPointerException, ArrayIndexOutOfBoundsException, ClassNotFoundException {
164
165
166 int condition = new java.util.Random().nextInt(3);
167 switch (condition) {
168 case 0:
169 throw new IOException("Test IOException");
170 case 1:
171 throw new NullPointerException("Test NullPointerException");
172 case 2:
173 throw new ArrayIndexOutOfBoundsException("Test ArrayIndexOutOfBoundsException");
174 case 3:
175 throw new ClassNotFoundException("Test ClassNotFoundException");
176 default:
177 }
178 }
179
180
181 class LonggggggggggggggggggggggggggggClassssssssssssssssssssssssssNameeeeeeeeeeeeeeSoooooBoooooorrriinngggg1 {
182
183 void longggggggggggggggggggggmethooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddddddddddddddddddd(int x, int y) {}
184
185
186
187 int aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaablleeeeeeeeeeee = 99;
188
189 }
190
191
192 class LonggggggggggggggggggggggggggggClassssssssssssssssssssssssssNameeeeeeeeeeeeeeSoooooBoooooorrriinngggg2 {
193
194 void longggggggggggggggggggggmethooooooooooooooooooooooddddddddddddddddddddddddddddddddddddddddddddddddddddddd(int x, int y) {}
195
196
197 int aaaarealllllllllllllllllyyyyyyyyyyylllllllloooooooooooooooonnnnnnnnnnnnnnnnnggggggggggvvvvvvaarriaaablleeeeeeeeeeee = 99;
198 }
199 }