@@ -81,22 +81,22 @@ public void testBase64() {
8181 String encodedContent ;
8282 byte [] encodedBytes = Base64 .encodeBase64 (StringUtils .getBytesUtf8 (content ));
8383 encodedContent = StringUtils .newStringUtf8 (encodedBytes );
84- assertTrue ("encoding hello world" , encodedContent . equals ( "SGVsbG8gV29ybGQ=" ) );
84+ assertEquals ("encoding hello world" , "SGVsbG8gV29ybGQ=" , encodedContent );
8585
8686 Base64 b64 = new Base64 (BaseNCodec .MIME_CHUNK_SIZE , null ); // null lineSeparator same as saying no-chunking
8787 encodedBytes = b64 .encode (StringUtils .getBytesUtf8 (content ));
8888 encodedContent = StringUtils .newStringUtf8 (encodedBytes );
89- assertTrue ("encoding hello world" , encodedContent . equals ( "SGVsbG8gV29ybGQ=" ) );
89+ assertEquals ("encoding hello world" , "SGVsbG8gV29ybGQ=" , encodedContent );
9090
9191 b64 = new Base64 (0 , null ); // null lineSeparator same as saying no-chunking
9292 encodedBytes = b64 .encode (StringUtils .getBytesUtf8 (content ));
9393 encodedContent = StringUtils .newStringUtf8 (encodedBytes );
94- assertTrue ("encoding hello world" , encodedContent . equals ( "SGVsbG8gV29ybGQ=" ) );
94+ assertEquals ("encoding hello world" , "SGVsbG8gV29ybGQ=" , encodedContent );
9595
9696 // bogus characters to decode (to skip actually) {e-acute*6}
9797 byte [] decode = b64 .decode ("SGVsbG{\u00e9 \u00e9 \u00e9 \u00e9 \u00e9 \u00e9 }8gV29ybGQ=" );
9898 String decodeString = StringUtils .newStringUtf8 (decode );
99- assertTrue ("decode hello world" , decodeString . equals ( "Hello World" ) );
99+ assertEquals ("decode hello world" , "Hello World" , decodeString );
100100 }
101101
102102 /**
@@ -263,24 +263,24 @@ public void testDecodePadMarkerIndex3() throws UnsupportedEncodingException {
263263
264264 @ Test
265265 public void testDecodePadOnly () throws UnsupportedEncodingException {
266- assertTrue ( Base64 .decodeBase64 ("====" .getBytes ("UTF-8" )).length == 0 );
266+ assertEquals ( 0 , Base64 .decodeBase64 ("====" .getBytes ("UTF-8" )).length );
267267 assertEquals ("" , new String (Base64 .decodeBase64 ("====" .getBytes ("UTF-8" ))));
268268 // Test truncated padding
269- assertTrue ( Base64 .decodeBase64 ("===" .getBytes ("UTF-8" )).length == 0 );
270- assertTrue ( Base64 .decodeBase64 ("==" .getBytes ("UTF-8" )).length == 0 );
271- assertTrue ( Base64 .decodeBase64 ("=" .getBytes ("UTF-8" )).length == 0 );
272- assertTrue ( Base64 .decodeBase64 ("" .getBytes ("UTF-8" )).length == 0 );
269+ assertEquals ( 0 , Base64 .decodeBase64 ("===" .getBytes ("UTF-8" )).length );
270+ assertEquals ( 0 , Base64 .decodeBase64 ("==" .getBytes ("UTF-8" )).length );
271+ assertEquals ( 0 , Base64 .decodeBase64 ("=" .getBytes ("UTF-8" )).length );
272+ assertEquals ( 0 , Base64 .decodeBase64 ("" .getBytes ("UTF-8" )).length );
273273 }
274274
275275 @ Test
276276 public void testDecodePadOnlyChunked () throws UnsupportedEncodingException {
277- assertTrue ( Base64 .decodeBase64 ("====\n " .getBytes ("UTF-8" )).length == 0 );
277+ assertEquals ( 0 , Base64 .decodeBase64 ("====\n " .getBytes ("UTF-8" )).length );
278278 assertEquals ("" , new String (Base64 .decodeBase64 ("====\n " .getBytes ("UTF-8" ))));
279279 // Test truncated padding
280- assertTrue ( Base64 .decodeBase64 ("===\n " .getBytes ("UTF-8" )).length == 0 );
281- assertTrue ( Base64 .decodeBase64 ("==\n " .getBytes ("UTF-8" )).length == 0 );
282- assertTrue ( Base64 .decodeBase64 ("=\n " .getBytes ("UTF-8" )).length == 0 );
283- assertTrue ( Base64 .decodeBase64 ("\n " .getBytes ("UTF-8" )).length == 0 );
280+ assertEquals ( 0 , Base64 .decodeBase64 ("===\n " .getBytes ("UTF-8" )).length );
281+ assertEquals ( 0 , Base64 .decodeBase64 ("==\n " .getBytes ("UTF-8" )).length );
282+ assertEquals ( 0 , Base64 .decodeBase64 ("=\n " .getBytes ("UTF-8" )).length );
283+ assertEquals ( 0 , Base64 .decodeBase64 ("\n " .getBytes ("UTF-8" )).length );
284284 }
285285
286286 @ Test
@@ -301,7 +301,7 @@ public void testDecodeWithWhitespace() throws Exception {
301301
302302 String dest = new String (decodedWithWS );
303303
304- assertTrue ("Dest string doesn't equal the original" , dest . equals ( orig ) );
304+ assertEquals ("Dest string doesn't equal the original" , orig , dest );
305305 }
306306
307307 /**
@@ -454,8 +454,8 @@ public void testNonBase64Test() throws Exception {
454454 Base64 b64 = new Base64 ();
455455 byte [] result = b64 .decode (bArray );
456456
457- assertTrue ("The result should be empty as the test encoded content did " + "not contain any valid base 64 characters" ,
458- result .length == 0 );
457+ assertEquals ("The result should be empty as the test encoded content did " + "not contain any valid base 64 characters" ,
458+ 0 , result .length );
459459 } catch (Exception e ) {
460460 fail ("Exception was thrown when trying to decode "
461461 + "invalid base64 encoded data - RFC 2045 requires that all "
@@ -488,7 +488,7 @@ public void testObjectDecodeWithValidParameter() throws Exception {
488488 byte [] baDecoded = (byte []) oDecoded ;
489489 String dest = new String (baDecoded );
490490
491- assertTrue ("dest string does not equal original" , dest . equals ( original ) );
491+ assertEquals ("dest string does not equal original" , original , dest );
492492 }
493493
494494 @ Test
@@ -513,7 +513,7 @@ public void testObjectEncodeWithValidParameter() throws Exception {
513513 byte [] bArray = Base64 .decodeBase64 ((byte []) oEncoded );
514514 String dest = new String (bArray );
515515
516- assertTrue ("dest string does not equal original" , dest . equals ( original ) );
516+ assertEquals ("dest string does not equal original" , original , dest );
517517 }
518518
519519 @ Test
@@ -1232,7 +1232,7 @@ public void testHugeLineSeparator() {
12321232 Base64 b64 = new Base64 (Base64_BYTES_PER_ENCODED_BLOCK , baLineSeparator );
12331233 String strOriginal = "Hello World" ;
12341234 String strDecoded = new String (b64 .decode (b64 .encode (StringUtils .getBytesUtf8 (strOriginal ))));
1235- assertTrue ("testDEFAULT_BUFFER_SIZE" , strOriginal . equals ( strDecoded ) );
1235+ assertEquals ("testDEFAULT_BUFFER_SIZE" , strOriginal , strDecoded );
12361236 }
12371237
12381238}
0 commit comments