Skip to content

Commit 40446e5

Browse files
committed
A few more tests
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@669672 13f79535-47bb-0310-9956-ffa450edef68
1 parent 6f16107 commit 40446e5

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/test/org/apache/commons/codec/binary/Base64Test.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ public void testIsArrayByteBase64() {
523523
assertFalse(Base64.isArrayByteBase64(new byte[] {Byte.MAX_VALUE}));
524524
assertTrue(Base64.isArrayByteBase64(new byte[] {'A'}));
525525
assertFalse(Base64.isArrayByteBase64(new byte[] {'A', Byte.MIN_VALUE}));
526+
assertTrue(Base64.isArrayByteBase64(new byte[] {'A', 'Z', 'a'}));
527+
assertTrue(Base64.isArrayByteBase64(new byte[] {'/','=','+'}));
528+
assertFalse(Base64.isArrayByteBase64(new byte[] {'$'}));
526529
}
527530

528531
public void testObjectDecodeWithInvalidParameter() throws Exception {
@@ -531,7 +534,7 @@ public void testObjectDecodeWithInvalidParameter() throws Exception {
531534
Base64 b64 = new Base64();
532535

533536
try {
534-
Object o = new String( "Yadayadayada" );
537+
Object o = "Yadayadayada";
535538
b64.decode( o );
536539
} catch( Exception e ) {
537540
exceptionThrown = true;
@@ -545,7 +548,7 @@ public void testObjectDecodeWithValidParameter() throws Exception {
545548

546549
String original = "Hello World!";
547550
byte[] bArray =
548-
Base64.encodeBase64( (new String(original)).getBytes() );
551+
Base64.encodeBase64(original.getBytes() );
549552
Object o = bArray;
550553

551554
Base64 b64 = new Base64();
@@ -563,7 +566,7 @@ public void testObjectEncodeWithInvalidParameter() throws Exception {
563566
Base64 b64 = new Base64();
564567

565568
try {
566-
Object o = new String( "Yadayadayada" );
569+
Object o = "Yadayadayada";
567570
b64.encode( o );
568571
} catch( Exception e ) {
569572
exceptionThrown = true;
@@ -607,7 +610,7 @@ public void testDecodeWithWhitespace() throws Exception {
607610

608611
String dest = new String( decodedWithWS );
609612

610-
assertTrue( "Dest string doesn't equals the original",
613+
assertTrue( "Dest string doesn't equal the original",
611614
dest.equals( orig ) );
612615
}
613616

@@ -632,9 +635,9 @@ public void testDiscardWhitespace() throws Exception {
632635
String destFromWS = new String( decodedWithWS );
633636
String destFromNoWS = new String( decodedNoWS );
634637

635-
assertTrue( "Dest string doesn't eausl original",
638+
assertTrue( "Dest string doesn't equal original",
636639
destFromWS.equals( orig ) );
637-
assertTrue( "Dest string doesn't eausl original",
640+
assertTrue( "Dest string doesn't equal original",
638641
destFromNoWS.equals( orig ) );
639642
}
640643

0 commit comments

Comments
 (0)