File tree Expand file tree Collapse file tree
src/test/org/apache/commons/codec/binary Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments