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 2011/01/25 20:43:08 UTC

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

Author: sebb
Date: Tue Jan 25 19:43:08 2011
New Revision: 1063422

URL: http://svn.apache.org/viewvc?rev=1063422&view=rev
Log:
Don't use the now deprecated isArrayByteBase64 method, use its replacement isBase64
(No need to test the deprecated method as it delegates to the new one anyway)

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=1063422&r1=1063421&r2=1063422&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 Tue Jan 25 19:43:08 2011
@@ -97,7 +97,7 @@ public class Base64Test extends TestCase
         assertTrue("encoding hello world", encodedContent.equals("SGVsbG8gV29ybGQ="));
 
         // bogus characters to decode (to skip actually)
-        byte[] decode = b64.decode("SGVsbG{éééééé}8gV29ybGQ=");
+        byte[] decode = b64.decode("SGVsbG{������}8gV29ybGQ=");
         String decodeString = StringUtils.newStringUtf8(decode);
         assertTrue("decode hello world", decodeString.equals("Hello World"));        
     }
@@ -335,7 +335,7 @@ public class Base64Test extends TestCase
             byte[] data = new byte[this.getRandom().nextInt(10000) + 1];
             this.getRandom().nextBytes(data);
             byte[] enc = Base64.encodeBase64(data);
-            assertTrue(Base64.isArrayByteBase64(enc));
+            assertTrue(Base64.isBase64(enc));
             byte[] data2 = Base64.decodeBase64(enc);
             assertTrue(Arrays.equals(data, data2));
         }
@@ -347,7 +347,7 @@ public class Base64Test extends TestCase
             byte[] data = new byte[i];
             this.getRandom().nextBytes(data);
             byte[] enc = Base64.encodeBase64(data);
-            assertTrue("\"" + (new String(enc)) + "\" is Base64 data.", Base64.isArrayByteBase64(enc));
+            assertTrue("\"" + (new String(enc)) + "\" is Base64 data.", Base64.isBase64(enc));
             byte[] data2 = Base64.decodeBase64(enc);
             assertTrue(toString(data) + " equals " + toString(data2), Arrays.equals(data, data2));
         }
@@ -375,17 +375,17 @@ public class Base64Test extends TestCase
     }
 
     public void testIsArrayByteBase64() {
-        assertFalse(Base64.isArrayByteBase64(new byte[]{Byte.MIN_VALUE}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{-125}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{-10}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{0}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{64, Byte.MAX_VALUE}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{Byte.MAX_VALUE}));
-        assertTrue(Base64.isArrayByteBase64(new byte[]{'A'}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{'A', Byte.MIN_VALUE}));
-        assertTrue(Base64.isArrayByteBase64(new byte[]{'A', 'Z', 'a'}));
-        assertTrue(Base64.isArrayByteBase64(new byte[]{'/', '=', '+'}));
-        assertFalse(Base64.isArrayByteBase64(new byte[]{'$'}));
+        assertFalse(Base64.isBase64(new byte[]{Byte.MIN_VALUE}));
+        assertFalse(Base64.isBase64(new byte[]{-125}));
+        assertFalse(Base64.isBase64(new byte[]{-10}));
+        assertFalse(Base64.isBase64(new byte[]{0}));
+        assertFalse(Base64.isBase64(new byte[]{64, Byte.MAX_VALUE}));
+        assertFalse(Base64.isBase64(new byte[]{Byte.MAX_VALUE}));
+        assertTrue(Base64.isBase64(new byte[]{'A'}));
+        assertFalse(Base64.isBase64(new byte[]{'A', Byte.MIN_VALUE}));
+        assertTrue(Base64.isBase64(new byte[]{'A', 'Z', 'a'}));
+        assertTrue(Base64.isBase64(new byte[]{'/', '=', '+'}));
+        assertFalse(Base64.isBase64(new byte[]{'$'}));
     }
 
     /**
@@ -399,7 +399,7 @@ public class Base64Test extends TestCase
         assertTrue("Base64.isUrlSafe=true", base64URLSafe.isUrlSafe());
 
         byte[] whiteSpace = {' ', '\n', '\r', '\t'};
-        assertTrue("Base64.isArrayByteBase64(whiteSpace)=true", Base64.isArrayByteBase64(whiteSpace));
+        assertTrue("Base64.isBase64(whiteSpace)=true", Base64.isBase64(whiteSpace));
     }
 
     public void testKnownDecodings() throws UnsupportedEncodingException {
@@ -441,7 +441,7 @@ public class Base64Test extends TestCase
         byte[] bArray = {'%'};
 
         assertFalse("Invalid Base64 array was incorrectly validated as " + "an array of Base64 encoded data", Base64
-                .isArrayByteBase64(bArray));
+                .isBase64(bArray));
 
         try {
             Base64 b64 = new Base64();