Skip to content

Commit 38dfda0

Browse files
committed
Add constructor test.
[This will fail currently] git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@669748 13f79535-47bb-0310-9956-ffa450edef68
1 parent a0c1b19 commit 38dfda0

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,32 @@ public void testCodeIntegerEdgeCases() {
680680
// TODO
681681
}
682682

683+
public void testConstructors(){
684+
Base64 base64;
685+
base64 = new Base64();
686+
base64 = new Base64(-1);
687+
base64 = new Base64(-1,new byte[]{});
688+
base64 = new Base64(64,new byte[]{});
689+
try {
690+
base64 = new Base64(-1,new byte[]{'A'});
691+
fail("Should have rejected attempt to use 'A' as a line separator");
692+
} catch (IllegalArgumentException ignored){
693+
694+
}
695+
try {
696+
base64 = new Base64(64,new byte[]{'A'});
697+
fail("Should have rejected attempt to use 'A' as a line separator");
698+
} catch (IllegalArgumentException ignored){
699+
700+
}
701+
base64 = new Base64(64,new byte[]{'$'}); // OK
702+
try {
703+
base64 = new Base64(64,new byte[]{'A','$'});
704+
fail("Should have rejected attempt to use 'A$' as a line separator");
705+
} catch (IllegalArgumentException ignored){
706+
707+
}
708+
}
683709
// -------------------------------------------------------- Private Methods
684710

685711
private String toString(byte[] data) {

0 commit comments

Comments
 (0)