1818 */
1919package org .apache .maven .plugins .javadoc ;
2020
21- import javax .servlet .ServletException ;
2221import javax .servlet .http .HttpServletRequest ;
2322import javax .servlet .http .HttpServletResponse ;
2423
@@ -113,17 +112,16 @@ public void testParseJavadocVersion() {
113112 assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
114113
115114 // 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 ( );
117116 assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
118117
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\" " ;
120119 assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
121120
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 ();
124122 assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
125123
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\" " ;
127125 assertEquals ("1.5.0" , JavadocUtil .extractJavadocVersion (version ));
128126
129127 version = "java full version \" 1.99.123-b01\" " ;
@@ -186,64 +184,63 @@ public void testParseJavadocMemoryEmpty() {
186184 */
187185 public void testParseJavadocMemory () {
188186 String memory = "128" ;
189- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
187+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
190188
191189 memory = "128k" ;
192- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128k" );
190+ assertEquals ("128k" , JavadocUtil .parseJavadocMemory (memory ));
193191 memory = "128kb" ;
194- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128k" );
192+ assertEquals ("128k" , JavadocUtil .parseJavadocMemory (memory ));
195193
196194 memory = "128m" ;
197- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
195+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
198196 memory = "128mb" ;
199- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
197+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
200198
201199 memory = "1g" ;
202- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1024m" );
200+ assertEquals ("1024m" , JavadocUtil .parseJavadocMemory (memory ));
203201 memory = "1gb" ;
204- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1024m" );
202+ assertEquals ("1024m" , JavadocUtil .parseJavadocMemory (memory ));
205203
206204 memory = "1t" ;
207- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1048576m" );
205+ assertEquals ("1048576m" , JavadocUtil .parseJavadocMemory (memory ));
208206 memory = "1tb" ;
209- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "1048576m" );
207+ assertEquals ("1048576m" , JavadocUtil .parseJavadocMemory (memory ));
210208
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 ));
215213
216214 memory = " 128m" ;
217- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
215+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
218216 memory = " 128m " ;
219- assertEquals (JavadocUtil .parseJavadocMemory (memory ), "128m" );
217+ assertEquals ("128m" , JavadocUtil .parseJavadocMemory (memory ));
220218
221219 memory = "1m28m" ;
222220 try {
223221 JavadocUtil .parseJavadocMemory (memory );
224222 fail ("Not catch wrong pattern" );
225223 } catch (IllegalArgumentException e ) {
226- assertTrue ( true );
224+ assertNotNull ( e . getMessage () );
227225 }
228226 memory = "ABC128m" ;
229227 try {
230228 JavadocUtil .parseJavadocMemory (memory );
231229 fail ("Not catch wrong pattern" );
232230 } catch (IllegalArgumentException e ) {
233- assertTrue ( true );
231+ assertNotNull ( e . getMessage () );
234232 }
235233 }
236234
237235 /**
238236 * Method to test the validate encoding parsing.
239- *
240237 */
241238 public void testValidateEncoding () {
242239 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" ));
247244 }
248245
249246 /**
@@ -261,7 +258,7 @@ public void testIsValidPackageList() throws Exception {
261258 JavadocUtil .isValidPackageList (url , settings , false );
262259 fail ();
263260 } catch (IllegalArgumentException e ) {
264- assertTrue ( true );
261+ assertNotNull ( e . getMessage () );
265262 }
266263
267264 url = new File (getBasedir (), "/pom.xml" ).toURI ().toURL ();
@@ -270,7 +267,7 @@ public void testIsValidPackageList() throws Exception {
270267 try {
271268 assertFalse (JavadocUtil .isValidPackageList (url , settings , true ));
272269 } catch (IOException e ) {
273- assertTrue ( true );
270+ assertNotNull ( e . getMessage () );
274271 }
275272
276273 url = this .getClass ()
@@ -287,7 +284,7 @@ public void testIsValidPackageList() throws Exception {
287284 JavadocUtil .isValidPackageList (wrongUrl , settings , false );
288285 fail ();
289286 } catch (IOException e ) {
290- assertTrue ( true );
287+ assertNotNull ( e . getMessage () );
291288 }
292289
293290 // real proxy
@@ -300,7 +297,7 @@ public void testIsValidPackageList() throws Exception {
300297 JavadocUtil .isValidPackageList (wrongUrl , settings , false );
301298 fail ();
302299 } catch (IOException e ) {
303- assertTrue ( true );
300+ assertNotNull ( e . getMessage () );
304301 }
305302 }
306303
@@ -322,7 +319,7 @@ public void testIsValidPackageList() throws Exception {
322319 JavadocUtil .isValidPackageList (url , settings , false );
323320 fail ();
324321 } catch (FileNotFoundException e ) {
325- assertTrue ( true );
322+ assertNotNull ( e . getMessage () );
326323 }
327324
328325 // auth proxy
@@ -346,7 +343,7 @@ public void testIsValidPackageList() throws Exception {
346343 JavadocUtil .isValidPackageList (wrongUrl , settings , false );
347344 fail ();
348345 } catch (IOException e ) {
349- assertTrue ( true );
346+ assertNotNull ( e . getMessage () );
350347 }
351348 }
352349
@@ -368,7 +365,7 @@ public void testIsValidPackageList() throws Exception {
368365 JavadocUtil .isValidPackageList (url , settings , true );
369366 fail ();
370367 } catch (SocketTimeoutException e ) {
371- assertTrue ( true );
368+ assertNotNull ( e . getMessage () );
372369 }
373370
374371 // nonProxyHosts
@@ -412,7 +409,7 @@ public void testGetRedirectUrl() throws Exception {
412409 @ Override
413410 public void handle (
414411 String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response )
415- throws IOException , ServletException {
412+ throws IOException {
416413 response .setStatus (HttpServletResponse .SC_OK );
417414 ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer (100 );
418415 writer .write ("<html>Hello world</html>" );
@@ -456,7 +453,7 @@ public void testGetRedirectUrlWithNoRedirects() throws Exception {
456453 @ Override
457454 public void handle (
458455 String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response )
459- throws IOException , ServletException {
456+ throws IOException {
460457 response .setStatus (HttpServletResponse .SC_OK );
461458 ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer (100 );
462459 writer .write ("<html>Hello world</html>" );
@@ -492,7 +489,7 @@ public void testGetRedirectUrlVerifyHeaders() throws Exception {
492489 @ Override
493490 public void handle (
494491 String target , Request baseRequest , HttpServletRequest request , HttpServletResponse response )
495- throws IOException , ServletException {
492+ throws IOException {
496493
497494 if (request .getHeader ("Accept" ) == null ) {
498495 response .setStatus (HttpServletResponse .SC_FORBIDDEN );
@@ -567,7 +564,6 @@ public void testCopyJavadocResources() throws Exception {
567564
568565 /**
569566 * Method to test pruneDirs()
570- *
571567 */
572568 public void testPruneDirs () {
573569 List <String > list = new ArrayList <>();
@@ -612,7 +608,6 @@ public void testPrunePaths() {
612608
613609 /**
614610 * Method to test unifyPathSeparator()
615- *
616611 */
617612 public void testUnifyPathSeparator () {
618613 assertNull (JavadocUtil .unifyPathSeparator (null ));
@@ -668,7 +663,7 @@ private void stopSilently(Server server) {
668663 }
669664 }
670665
671- public void testQuotedArgument () throws Exception {
666+ public void testQuotedArgument () {
672667
673668 String value = " org.apache.uima.analysis_component:\n org.apache.uima.analysis_engine\n " ;
674669
@@ -681,7 +676,7 @@ public void testQuotedArgument() throws Exception {
681676 assertEquals ("'org.apache.uima.analysis_component:org.apache.uima.analysis_engine'" , arg );
682677 }
683678
684- public void testToList () throws Exception {
679+ public void testToList () {
685680 String value = " *.internal:org.acme.exclude1.*:\n org.acme.exclude2\n " ;
686681 List <String > values = JavadocUtil .toList (value );
687682 assertThat (values ).containsExactly ("*.internal" , "org.acme.exclude1.*" , "org.acme.exclude2" );
0 commit comments