You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2008/06/20 02:00:42 UTC

svn commit: r669748 - /commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

Author: sebb
Date: Thu Jun 19 17:00:41 2008
New Revision: 669748

URL: http://svn.apache.org/viewvc?rev=669748&view=rev
Log:
Add constructor test. 
[This will fail currently]

Modified:
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java?rev=669748&r1=669747&r2=669748&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java Thu Jun 19 17:00:41 2008
@@ -680,6 +680,32 @@
         // TODO
     }
 
+    public void testConstructors(){
+        Base64 base64;
+        base64 = new Base64();
+        base64 = new Base64(-1);
+        base64 = new Base64(-1,new byte[]{});
+        base64 = new Base64(64,new byte[]{});
+        try {
+            base64 = new Base64(-1,new byte[]{'A'});
+            fail("Should have rejected attempt to use 'A' as a line separator");
+        } catch (IllegalArgumentException ignored){
+            
+        }
+        try {
+            base64 = new Base64(64,new byte[]{'A'});
+            fail("Should have rejected attempt to use 'A' as a line separator");
+        } catch (IllegalArgumentException ignored){
+            
+        }
+        base64 = new Base64(64,new byte[]{'$'}); // OK
+        try {
+            base64 = new Base64(64,new byte[]{'A','$'});
+            fail("Should have rejected attempt to use 'A$' as a line separator");
+        } catch (IllegalArgumentException ignored){
+            
+        }
+    }
     // -------------------------------------------------------- Private Methods
 
     private String toString(byte[] data) {