Skip to content

Commit a9717b6

Browse files
committed
Add more base64 tests
1 parent eacf539 commit a9717b6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/test/java/at/favre/lib/bytes/Base64Test.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323

2424
import org.junit.Test;
2525

26-
import static org.junit.Assert.assertArrayEquals;
27-
import static org.junit.Assert.assertEquals;
26+
import static org.junit.Assert.*;
2827

2928
/**
3029
* Test cases from rfc4648
@@ -42,6 +41,9 @@ public void decode() throws Exception {
4241
assertArrayEquals("foobar".getBytes(), Base64.decode("Zm9vYmFy"));
4342
assertArrayEquals("k".getBytes(), Base64.decode("a+"));
4443
assertArrayEquals("i".getBytes(), Base64.decode("aZ\n"));
44+
assertArrayEquals("foob".getBytes(), Base64.decode("Zm9vYg=========="));
45+
assertArrayEquals(new byte[]{106, -64}, Base64.decode("a\rs\t\nC "));
46+
assertNull(Base64.decode("a\r\t\n "));
4547
}
4648

4749
@Test
@@ -55,6 +57,7 @@ public void encode() throws Exception {
5557
assertEquals("Zm9vYmFy", Base64.encode("foobar".getBytes()));
5658
assertEquals("aQo=", Base64.encode("i\n".getBytes()));
5759
assertEquals("aSA=", Base64.encode("i ".getBytes()));
60+
5861
}
5962

6063
}

0 commit comments

Comments
 (0)