18
18
*/
19
19
package org .apache .maven .plugins .javadoc ;
20
20
21
- import javax .servlet .ServletException ;
22
21
import javax .servlet .http .HttpServletRequest ;
23
22
import javax .servlet .http .HttpServletResponse ;
24
23
@@ -113,17 +112,16 @@ public void testParseJavadocVersion() {
113
112
assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
114
113
115
114
// Other tests
116
- version = "java full version \" 1.5.0_07-164\" " + System .getProperty ( "line.separator" );
115
+ version = "java full version \" 1.5.0_07-164\" " + System .lineSeparator ( );
117
116
assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
118
117
119
- version = System .getProperty ( "line.separator" ) + "java full version \" 1.5.0_07-164\" " ;
118
+ version = System .lineSeparator ( ) + "java full version \" 1.5.0_07-164\" " ;
120
119
assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
121
120
122
- version = System .getProperty ("line.separator" ) + "java full version \" 1.5.0_07-164\" "
123
- + System .getProperty ("line.separator" );
121
+ version = System .lineSeparator () + "java full version \" 1.5.0_07-164\" " + System .lineSeparator ();
124
122
assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
125
123
126
- version = "java full" + System .getProperty ( "line.separator" ) + " version \" 1.5.0_07-164\" " ;
124
+ version = "java full" + System .lineSeparator ( ) + " version \" 1.5.0_07-164\" " ;
127
125
assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
128
126
129
127
version = "java full version \" 1.99.123-b01\" " ;
@@ -186,64 +184,63 @@ public void testParseJavadocMemoryEmpty() {
186
184
*/
187
185
public void testParseJavadocMemory () {
188
186
String memory = "128" ;
189
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
187
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
190
188
191
189
memory = "128k" ;
192
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128k" );
190
+ assertEquals ("128k" , JavadocUtil .parseJavadocMemory (memory ));
193
191
memory = "128kb" ;
194
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128k" );
192
+ assertEquals ("128k" , JavadocUtil .parseJavadocMemory (memory ));
195
193
196
194
memory = "128m" ;
197
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
195
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
198
196
memory = "128mb" ;
199
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
197
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
200
198
201
199
memory = "1g" ;
202
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1024m" );
200
+ assertEquals ("1024m" , JavadocUtil .parseJavadocMemory (memory ));
203
201
memory = "1gb" ;
204
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1024m" );
202
+ assertEquals ("1024m" , JavadocUtil .parseJavadocMemory (memory ));
205
203
206
204
memory = "1t" ;
207
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1048576m" );
205
+ assertEquals ("1048576m" , JavadocUtil .parseJavadocMemory (memory ));
208
206
memory = "1tb" ;
209
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1048576m" );
207
+ assertEquals ("1048576m" , JavadocUtil .parseJavadocMemory (memory ));
210
208
211
- memory = System .getProperty ( "line.separator" ) + "128m" ;
212
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
213
- memory = System .getProperty ( "line.separator" ) + "128m" + System .getProperty ( "line.separator" );
214
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
209
+ memory = System .lineSeparator ( ) + "128m" ;
210
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
211
+ memory = System .lineSeparator ( ) + "128m" + System .lineSeparator ( );
212
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
215
213
216
214
memory = " 128m" ;
217
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
215
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
218
216
memory = " 128m " ;
219
- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
217
+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
220
218
221
219
memory = "1m28m" ;
222
220
try {
223
221
JavadocUtil .parseJavadocMemory (memory );
224
222
fail ("Not catch wrong pattern" );
225
223
} catch (IllegalArgumentException e ) {
226
- assertTrue ( true );
224
+ assertNotNull ( e . getMessage () );
227
225
}
228
226
memory = "ABC128m" ;
229
227
try {
230
228
JavadocUtil .parseJavadocMemory (memory );
231
229
fail ("Not catch wrong pattern" );
232
230
} catch (IllegalArgumentException e ) {
233
- assertTrue ( true );
231
+ assertNotNull ( e . getMessage () );
234
232
}
235
233
}
236
234
237
235
/**
238
236
* Method to test the validate encoding parsing.
239
- *
240
237
*/
241
238
public void testValidateEncoding () {
242
239
assertFalse ("Not catch null" , JavadocUtil .validateEncoding (null ));
243
- assertTrue ("UTF-8 not supported on this plateform " , JavadocUtil .validateEncoding ("UTF-8" ));
244
- assertTrue ("ISO-8859-1 not supported on this plateform " , JavadocUtil .validateEncoding ("ISO-8859-1" ));
245
- assertFalse ("latin is supported on this plateform ???" , JavadocUtil .validateEncoding ("latin" ));
246
- assertFalse ("WRONG is supported on this plateform ???" , JavadocUtil .validateEncoding ("WRONG" ));
240
+ assertTrue ("UTF-8 not supported on this platform " , JavadocUtil .validateEncoding ("UTF-8" ));
241
+ assertTrue ("ISO-8859-1 not supported on this platform " , JavadocUtil .validateEncoding ("ISO-8859-1" ));
242
+ assertFalse ("latin is supported on this platform ???" , JavadocUtil .validateEncoding ("latin" ));
243
+ assertFalse ("WRONG is supported on this platform ???" , JavadocUtil .validateEncoding ("WRONG" ));
247
244
}
248
245
249
246
/**
@@ -261,7 +258,7 @@ public void testIsValidPackageList() throws Exception {
261
258
JavadocUtil .isValidPackageList (url , settings , false );
262
259
fail ();
263
260
} catch (IllegalArgumentException e ) {
264
- assertTrue ( true );
261
+ assertNotNull ( e . getMessage () );
265
262
}
266
263
267
264
url = new File (getBasedir (), "/pom.xml" ).toURI ().toURL ();
@@ -270,7 +267,7 @@ public void testIsValidPackageList() throws Exception {
270
267
try {
271
268
assertFalse (JavadocUtil .isValidPackageList (url , settings , true ));
272
269
} catch (IOException e ) {
273
- assertTrue ( true );
270
+ assertNotNull ( e . getMessage () );
274
271
}
275
272
276
273
url = this .getClass ()
@@ -287,7 +284,7 @@ public void testIsValidPackageList() throws Exception {
287
284
JavadocUtil .isValidPackageList (wrongUrl , settings , false );
288
285
fail ();
289
286
} catch (IOException e ) {
290
- assertTrue ( true );
287
+ assertNotNull ( e . getMessage () );
291
288
}
292
289
293
290
// real proxy
@@ -300,7 +297,7 @@ public void testIsValidPackageList() throws Exception {
300
297
JavadocUtil .isValidPackageList (wrongUrl , settings , false );
301
298
fail ();
302
299
} catch (IOException e ) {
303
- assertTrue ( true );
300
+ assertNotNull ( e . getMessage () );
304
301
}
305
302
}
306
303
@@ -322,7 +319,7 @@ public void testIsValidPackageList() throws Exception {
322
319
JavadocUtil .isValidPackageList (url , settings , false );
323
320
fail ();
324
321
} catch (FileNotFoundException e ) {
325
- assertTrue ( true );
322
+ assertNotNull ( e . getMessage () );
326
323
}
327
324
328
325
// auth proxy
@@ -346,7 +343,7 @@ public void testIsValidPackageList() throws Exception {
346
343
JavadocUtil .isValidPackageList (wrongUrl , settings , false );
347
344
fail ();
348
345
} catch (IOException e ) {
349
- assertTrue ( true );
346
+ assertNotNull ( e . getMessage () );
350
347
}
351
348
}
352
349
@@ -368,7 +365,7 @@ public void testIsValidPackageList() throws Exception {
368
365
JavadocUtil .isValidPackageList (url , settings , true );
369
366
fail ();
370
367
} catch (SocketTimeoutException e ) {
371
- assertTrue ( true );
368
+ assertNotNull ( e . getMessage () );
372
369
}
373
370
374
371
// nonProxyHosts
@@ -412,7 +409,7 @@ public void testGetRedirectUrl() throws Exception {
412
409
@ Override
413
410
public void handle (
414
411
String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response )
415
- throws IOException , ServletException {
412
+ throws IOException {
416
413
response .setStatus (HttpServletResponse .SC_OK );
417
414
ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer (100 );
418
415
writer .write ("<html>Hello world</html>" );
@@ -456,7 +453,7 @@ public void testGetRedirectUrlWithNoRedirects() throws Exception {
456
453
@ Override
457
454
public void handle (
458
455
String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response )
459
- throws IOException , ServletException {
456
+ throws IOException {
460
457
response .setStatus (HttpServletResponse .SC_OK );
461
458
ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer (100 );
462
459
writer .write ("<html>Hello world</html>" );
@@ -492,7 +489,7 @@ public void testGetRedirectUrlVerifyHeaders() throws Exception {
492
489
@ Override
493
490
public void handle (
494
491
String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response )
495
- throws IOException , ServletException {
492
+ throws IOException {
496
493
497
494
if (request .getHeader ("Accept" ) == null ) {
498
495
response .setStatus (HttpServletResponse .SC_FORBIDDEN );
@@ -567,7 +564,6 @@ public void testCopyJavadocResources() throws Exception {
567
564
568
565
/**
569
566
* Method to test pruneDirs()
570
- *
571
567
*/
572
568
public void testPruneDirs () {
573
569
List <String > list = new ArrayList <>();
@@ -612,7 +608,6 @@ public void testPrunePaths() {
612
608
613
609
/**
614
610
* Method to test unifyPathSeparator()
615
- *
616
611
*/
617
612
public void testUnifyPathSeparator () {
618
613
assertNull (JavadocUtil .unifyPathSeparator (null ));
@@ -668,7 +663,7 @@ private void stopSilently(Server server) {
668
663
}
669
664
}
670
665
671
- public void testQuotedArgument () throws Exception {
666
+ public void testQuotedArgument () {
672
667
673
668
String value = " org.apache.uima.analysis_component:\n org.apache.uima.analysis_engine\n " ;
674
669
@@ -681,7 +676,7 @@ public void testQuotedArgument() throws Exception {
681
676
assertEquals ("'org.apache.uima.analysis_component:org.apache.uima.analysis_engine'" , arg );
682
677
}
683
678
684
- public void testToList () throws Exception {
679
+ public void testToList () {
685
680
String value = " *.internal:org.acme.exclude1.*:\n org.acme.exclude2\n " ;
686
681
List <String > values = JavadocUtil .toList (value );
687
682
assertThat (values ).containsExactly ("*.internal" , "org.acme.exclude1.*" , "org.acme.exclude2" );
0 commit comments