From 7b7ba826a2a490eae725a11ab02f745cd00173cc Mon Sep 17 00:00:00 2001 From: ftiercelin Date: Tue, 22 Oct 2024 12:13:58 +0100 Subject: [PATCH 1/2] reinstate testEncodeAuto UT --- .../zxing/pdf417/encoder/PDF417EncoderTestCase.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java b/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java index 01ef7b5d7..1b30551b6 100644 --- a/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java +++ b/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java @@ -35,7 +35,14 @@ import org.junit.Test; * Tests {@link PDF417HighLevelEncoder}. */ public final class PDF417EncoderTestCase extends Assert { - + private static final String PDF417PFX = "\u039f\u001A\u0385"; + @Test + public void testEncodeAuto() throws Exception { + String encoded = PDF417HighLevelEncoder.encodeHighLevel( + "ABCD", Compaction.AUTO, StandardCharsets.UTF_8, false); + assertEquals(PDF417PFX + "ABCD", encoded); + } + @Test public void testEncodeAutoWithSpecialChars() throws Exception { // Just check if this does not throw an exception @@ -98,8 +105,8 @@ public final class PDF417EncoderTestCase extends Assert { } } - public void checkEncodeAutoWithSpecialChars(String input, Compaction compaction) throws Exception { - PDF417HighLevelEncoder.encodeHighLevel(input, compaction, StandardCharsets.UTF_8, false); + public String checkEncodeAutoWithSpecialChars(String input, Compaction compaction) throws Exception { + return PDF417HighLevelEncoder.encodeHighLevel(input, compaction, StandardCharsets.UTF_8, false); } @Test From 0e8dbcb0cfe9e70ba11cd6a417b3a3eddb308e16 Mon Sep 17 00:00:00 2001 From: ftiercelin Date: Tue, 22 Oct 2024 12:21:43 +0100 Subject: [PATCH 2/2] refactor testEncodeAuto UT --- .../google/zxing/pdf417/encoder/PDF417EncoderTestCase.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java b/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java index 1b30551b6..bb875b82a 100644 --- a/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java +++ b/core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java @@ -38,9 +38,8 @@ public final class PDF417EncoderTestCase extends Assert { private static final String PDF417PFX = "\u039f\u001A\u0385"; @Test public void testEncodeAuto() throws Exception { - String encoded = PDF417HighLevelEncoder.encodeHighLevel( - "ABCD", Compaction.AUTO, StandardCharsets.UTF_8, false); - assertEquals(PDF417PFX + "ABCD", encoded); + String input = "ABCD"; + assertEquals(PDF417PFX + input, checkEncodeAutoWithSpecialChars(input, Compaction.AUTO)); } @Test