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/21 04:22:02 UTC
svn commit: r670118 -
/commons/proper/codec/trunk/src/test/org/apache/commons/codec/binary/Base64Test.java
Author: sebb
Date: Fri Jun 20 19:22:02 2008
New Revision: 670118
URL: http://svn.apache.org/viewvc?rev=670118&view=rev
Log:
Test truncated padding
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=670118&r1=670117&r2=670118&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 Fri Jun 20 19:22:02 2008
@@ -73,11 +73,21 @@
public void testDecodePadOnly() {
assertTrue(Base64.decodeBase64("====".getBytes()).length == 0);
assertEquals("", new String(Base64.decodeBase64("====".getBytes())));
+ // Test truncated padding
+ assertTrue(Base64.decodeBase64("===".getBytes()).length == 0);
+ assertTrue(Base64.decodeBase64("==".getBytes()).length == 0);
+ assertTrue(Base64.decodeBase64("=".getBytes()).length == 0);
+ assertTrue(Base64.decodeBase64("".getBytes()).length == 0);
}
public void testDecodePadOnlyChunked() {
assertTrue(Base64.decodeBase64("====\n".getBytes()).length == 0);
assertEquals("", new String(Base64.decodeBase64("====\n".getBytes())));
+ // Test truncated padding
+ assertTrue(Base64.decodeBase64("===\n".getBytes()).length == 0);
+ assertTrue(Base64.decodeBase64("==\n".getBytes()).length == 0);
+ assertTrue(Base64.decodeBase64("=\n".getBytes()).length == 0);
+ assertTrue(Base64.decodeBase64("\n".getBytes()).length == 0);
}
// encode/decode random arrays from size 0 to size 11