You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2020/08/27 23:19:08 UTC
[commons-codec] 08/08: Test Context toString has debugging info
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 fa0562e71e2661768c4d2e324ff978aa2af1be08
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Fri Aug 28 00:18:19 2020 +0100
Test Context toString has debugging info
---
.../commons/codec/binary/BaseNCodecTest.java | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java b/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
index 1b1d0b5..3b0800b 100644
--- a/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
@@ -51,6 +51,33 @@ public class BaseNCodecTest {
};
}
+ /**
+ * Test the Context string representation has debugging info.
+ * This is not part of the API and the test should be changed if the string
+ * format is updated.
+ */
+ @Test
+ public void testContextToString() {
+ final Context context = new Context();
+ context.buffer = new byte[3];
+ context.currentLinePos = 13;
+ context.eof = true;
+ context.ibitWorkArea = 777;
+ context.lbitWorkArea = 999;
+ context.modulus = 5;
+ context.pos = 42;
+ context.readPos = 981;
+ final String text = context.toString();
+ Assert.assertTrue(text.contains("[0, 0, 0]"));
+ Assert.assertTrue(text.contains("13"));
+ Assert.assertTrue(text.contains("true"));
+ Assert.assertTrue(text.contains("777"));
+ Assert.assertTrue(text.contains("999"));
+ Assert.assertTrue(text.contains("5"));
+ Assert.assertTrue(text.contains("42"));
+ Assert.assertTrue(text.contains("981"));
+ }
+
@Test
public void testBaseNCodec() {
assertNotNull(codec);