diff options
| author | AlexGeller1 <87009702+AlexGeller1@users.noreply.github.com> | 2022-05-06 02:01:14 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-06 02:01:14 +0300 |
| commit | 78faea80583e6fc903bdb8c146e8ff499b60c307 (patch) | |
| tree | 0604f28fa490a93ccd872370196427d0d6f4b8fc /core/src/test/java/com/google | |
| parent | c7a7b30f0497e01bed97fd465e4645594ee35fda (diff) | |
| download | zxing-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/com/google')
| -rw-r--r-- | core/src/test/java/com/google/zxing/pdf417/encoder/PDF417EncoderTestCase.java | 6 |
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); + } } |
