summaryrefslogtreecommitdiff
path: root/core/src/test/java/com
diff options
context:
space:
mode:
authorSean Owen <srowen@gmail.com>2016-08-08 13:30:18 +0300
committerSean Owen <srowen@gmail.com>2016-08-08 13:30:18 +0300
commitba6ce9fb25b37914cbd6429725d80465d662eb5c (patch)
treee9b43eb233c75bd97607ca64c806290ce385945d /core/src/test/java/com
parentd60c0f14bda2a2b6f9a1f24ca4c17236a52125df (diff)
downloadzxing-ba6ce9fb25b37914cbd6429725d80465d662eb5c.tar.xz
Minor follow on to last QR code version hint commit
Diffstat (limited to 'core/src/test/java/com')
-rw-r--r--core/src/test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java22
1 files changed, 8 insertions, 14 deletions
diff --git a/core/src/test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java b/core/src/test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java
index 51d4003df..96c785e60 100644
--- a/core/src/test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java
+++ b/core/src/test/java/com/google/zxing/qrcode/encoder/EncoderTestCase.java
@@ -28,7 +28,6 @@ import org.junit.Test;
import java.io.UnsupportedEncodingException;
import java.util.EnumMap;
-import java.util.HashMap;
import java.util.Map;
/**
@@ -131,22 +130,17 @@ public final class EncoderTestCase extends Assert {
@Test
public void testEncodeWithVersion() throws WriterException {
- Map<EncodeHintType, Object> hints = new HashMap<>();
- hints.put(EncodeHintType.QR_VERSION, 7);
- QRCode qrCode = Encoder.encode("ABCDEF", ErrorCorrectionLevel.H, hints);
- assertTrue(qrCode.toString().contains(" version: 7\n"));
+ Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
+ hints.put(EncodeHintType.QR_VERSION, 7);
+ QRCode qrCode = Encoder.encode("ABCDEF", ErrorCorrectionLevel.H, hints);
+ assertTrue(qrCode.toString().contains(" version: 7\n"));
}
- @Test
+ @Test(expected = WriterException.class)
public void testEncodeWithVersionTooSmall() throws WriterException {
- Map<EncodeHintType, Object> hints = new HashMap<>();
- hints.put(EncodeHintType.QR_VERSION, 3);
- try {
- Encoder.encode("THISMESSAGEISTOOLONGFORAQRCODEVERSION3", ErrorCorrectionLevel.H, hints);
- fail();
- } catch (WriterException e) {
- assertEquals("Data too big for requested version", e.getMessage());
- }
+ Map<EncodeHintType, Object> hints = new EnumMap<>(EncodeHintType.class);
+ hints.put(EncodeHintType.QR_VERSION, 3);
+ Encoder.encode("THISMESSAGEISTOOLONGFORAQRCODEVERSION3", ErrorCorrectionLevel.H, hints);
}
@Test