summaryrefslogtreecommitdiff
path: root/core/src/test/java
diff options
context:
space:
mode:
authorAlexGeller1 <87009702+AlexGeller1@users.noreply.github.com>2022-05-06 02:01:14 +0300
committerGitHub <noreply@github.com>2022-05-06 02:01:14 +0300
commit78faea80583e6fc903bdb8c146e8ff499b60c307 (patch)
tree0604f28fa490a93ccd872370196427d0d6f4b8fc /core/src/test/java
parentc7a7b30f0497e01bed97fd465e4645594ee35fda (diff)
downloadzxing-78faea80583e6fc903bdb8c146e8ff499b60c307.tar.xz
Prevent encoding of the empty string for PDF417 (#1523)
* Added code so that the PDF417 encoder throws an exception when attempting to encode the empty string
Diffstat (limited to 'core/src/test/java')
-rw-r--r--core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java6
1 files changed, 6 insertions, 0 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 8166333ed..f0c9aa5ab 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
@@ -16,6 +16,8 @@
package com.google.zxing.pdf417.encoder;
+import com.google.zxing.WriterException;
+
import java.nio.charset.StandardCharsets;
import org.junit.Assert;
@@ -67,4 +69,8 @@ public final class PDF417EncoderTestCase extends Assert {
assertEquals("\u039f\u001A\u0385abcd", encoded);
}
+ @Test(expected = WriterException.class)
+ public void testEncodeEmptyString() throws Exception {
+ PDF417HighLevelEncoder.encodeHighLevel("", Compaction.AUTO, null, false);
+ }
}