This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git

commit 536587931cb77538709c57455165379a74e2f04f
Author: Alex Herbert <[email protected]>
AuthorDate: Thu Aug 27 23:10:27 2020 +0100

    Test the codec policy property
---
 src/test/java/org/apache/commons/codec/binary/Base16Test.java | 2 ++
 src/test/java/org/apache/commons/codec/binary/Base32Test.java | 2 ++
 src/test/java/org/apache/commons/codec/binary/Base64Test.java | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/src/test/java/org/apache/commons/codec/binary/Base16Test.java 
b/src/test/java/org/apache/commons/codec/binary/Base16Test.java
index c9a6332..fc7249f 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base16Test.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base16Test.java
@@ -587,6 +587,7 @@ public class Base16Test {
         final String encoded = "aabbccdde";  // Note the trailing `e` which 
does not make up a hex-pair and so is only 1/2 byte
 
         final Base16 b16 = new Base16(true, CodecPolicy.STRICT);
+        assertEquals(CodecPolicy.STRICT, b16.getCodecPolicy());
         b16.decode(StringUtils.getBytesUtf8(encoded));
     }
 
@@ -595,6 +596,7 @@ public class Base16Test {
         final String encoded = "aabbccdde";  // Note the trailing `e` which 
does not make up a hex-pair and so is only 1/2 byte
 
         final Base16 b16 = new Base16(true, CodecPolicy.LENIENT);
+        assertEquals(CodecPolicy.LENIENT, b16.getCodecPolicy());
 
         final byte[] decoded = b16.decode(StringUtils.getBytesUtf8(encoded));
         assertArrayEquals(new byte[] {(byte)0xaa, (byte)0xbb, (byte)0xcc, 
(byte)0xdd}, decoded);
diff --git a/src/test/java/org/apache/commons/codec/binary/Base32Test.java 
b/src/test/java/org/apache/commons/codec/binary/Base32Test.java
index 83f1c2f..ddc286a 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base32Test.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base32Test.java
@@ -367,9 +367,11 @@ public class Base32Test {
         // Requires strict decoding
         final Base32 codec = new Base32(0, null, false, 
BaseNCodec.PAD_DEFAULT, CodecPolicy.STRICT);
         assertTrue(codec.isStrictDecoding());
+        assertEquals(CodecPolicy.STRICT, codec.getCodecPolicy());
         // A lenient decoder should not re-encode to the same bytes
         final Base32 defaultCodec = new Base32();
         assertFalse(defaultCodec.isStrictDecoding());
+        assertEquals(CodecPolicy.LENIENT, defaultCodec.getCodecPolicy());
 
         // Create the encoded bytes. The first characters must be valid so 
fill with 'zero'
         // then pad to the block size.
diff --git a/src/test/java/org/apache/commons/codec/binary/Base64Test.java 
b/src/test/java/org/apache/commons/codec/binary/Base64Test.java
index caf5363..82671ff 100644
--- a/src/test/java/org/apache/commons/codec/binary/Base64Test.java
+++ b/src/test/java/org/apache/commons/codec/binary/Base64Test.java
@@ -1363,9 +1363,11 @@ public class Base64Test {
         final Base64 codec = new Base64(0, null, false, CodecPolicy.STRICT);
         // Requires strict decoding
         assertTrue(codec.isStrictDecoding());
+        assertEquals(CodecPolicy.STRICT, codec.getCodecPolicy());
         // A lenient decoder should not re-encode to the same bytes
         final Base64 defaultCodec = new Base64();
         assertFalse(defaultCodec.isStrictDecoding());
+        assertEquals(CodecPolicy.LENIENT, defaultCodec.getCodecPolicy());
 
         // Create the encoded bytes. The first characters must be valid so 
fill with 'zero'
         // then pad to the block size.

Reply via email to