diff --git a/android/src/com/google/zxing/client/android/HttpHelper.java b/android/src/com/google/zxing/client/android/HttpHelper.java index 3f85bebb6..8bbed4b0a 100644 --- a/android/src/com/google/zxing/client/android/HttpHelper.java +++ b/android/src/com/google/zxing/client/android/HttpHelper.java @@ -197,7 +197,7 @@ public final class HttpHelper { throw new IOException(npe); } if (!(conn instanceof HttpURLConnection)) { - throw new IOException(); + throw new IOException("Expected HttpURLConnection but got " + conn.getClass()); } return (HttpURLConnection) conn; } diff --git a/core/src/main/java/com/google/zxing/common/BitMatrix.java b/core/src/main/java/com/google/zxing/common/BitMatrix.java index bd08efca4..afbee8ea7 100755 --- a/core/src/main/java/com/google/zxing/common/BitMatrix.java +++ b/core/src/main/java/com/google/zxing/common/BitMatrix.java @@ -41,7 +41,7 @@ public final class BitMatrix implements Cloneable { private final int[] bits; /** - * Creates an empty square {@link BitMatrix}. + * Creates an empty square {@code BitMatrix}. * * @param dimension height and width */ @@ -50,7 +50,7 @@ public final class BitMatrix implements Cloneable { } /** - * Creates an empty {@link BitMatrix}. + * Creates an empty {@code BitMatrix}. * * @param width bit matrix width * @param height bit matrix height @@ -73,10 +73,10 @@ public final class BitMatrix implements Cloneable { } /** - * Interprets a 2D array of booleans as a {@link BitMatrix}, where "true" means an "on" bit. + * Interprets a 2D array of booleans as a {@code BitMatrix}, where "true" means an "on" bit. * * @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows - * @return {@link BitMatrix} representation of image + * @return {@code BitMatrix} representation of image */ public static BitMatrix parse(boolean[][] image) { int height = image.length; diff --git a/core/src/main/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java b/core/src/main/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java index cdbaf3104..6969ca1cf 100644 --- a/core/src/main/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java +++ b/core/src/main/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParser.java @@ -185,7 +185,7 @@ final class DecodedBitStreamParser { default: // Not to be used in ASCII encodation // but work around encoders that end with 254, latch back to ASCII - if (oneByte >= 242 && (oneByte != 254 || bits.available() != 0)) { + if (oneByte != 254 || bits.available() != 0) { throw FormatException.getFormatInstance(); } break; diff --git a/core/src/main/java/com/google/zxing/datamatrix/encoder/C40Encoder.java b/core/src/main/java/com/google/zxing/datamatrix/encoder/C40Encoder.java index abc748620..d0e0c8440 100644 --- a/core/src/main/java/com/google/zxing/datamatrix/encoder/C40Encoder.java +++ b/core/src/main/java/com/google/zxing/datamatrix/encoder/C40Encoder.java @@ -129,40 +129,44 @@ class C40Encoder implements Encoder { if (c == ' ') { sb.append('\3'); return 1; - } else if (c >= '0' && c <= '9') { + } + if (c >= '0' && c <= '9') { sb.append((char) (c - 48 + 4)); return 1; - } else if (c >= 'A' && c <= 'Z') { + } + if (c >= 'A' && c <= 'Z') { sb.append((char) (c - 65 + 14)); return 1; - } else if (c >= '\0' && c <= '\u001f') { + } + if (c < ' ') { sb.append('\0'); //Shift 1 Set sb.append(c); return 2; - } else if (c >= '!' && c <= '/') { + } + if (c >= '!' && c <= '/') { sb.append('\1'); //Shift 2 Set sb.append((char) (c - 33)); return 2; - } else if (c >= ':' && c <= '@') { + } + if (c >= ':' && c <= '@') { sb.append('\1'); //Shift 2 Set sb.append((char) (c - 58 + 15)); return 2; - } else if (c >= '[' && c <= '_') { + } + if (c >= '[' && c <= '_') { sb.append('\1'); //Shift 2 Set sb.append((char) (c - 91 + 22)); return 2; - } else if (c >= '\u0060' && c <= '\u007f') { + } + if (c >= '`' && c <= 127) { sb.append('\2'); //Shift 3 Set sb.append((char) (c - 96)); return 2; - } else if (c >= '\u0080') { - sb.append("\1\u001e"); //Shift 2, Upper Shift - int len = 2; - len += encodeChar((char) (c - 128), sb); - return len; - } else { - throw new IllegalArgumentException("Illegal character: " + c); } + sb.append("\1\u001e"); //Shift 2, Upper Shift + int len = 2; + len += encodeChar((char) (c - 128), sb); + return len; } private static String encodeToCodewords(CharSequence sb, int startPos) { diff --git a/core/src/main/java/com/google/zxing/datamatrix/encoder/TextEncoder.java b/core/src/main/java/com/google/zxing/datamatrix/encoder/TextEncoder.java index 19af016b7..ef8ec0806 100644 --- a/core/src/main/java/com/google/zxing/datamatrix/encoder/TextEncoder.java +++ b/core/src/main/java/com/google/zxing/datamatrix/encoder/TextEncoder.java @@ -37,7 +37,7 @@ final class TextEncoder extends C40Encoder { sb.append((char) (c - 97 + 14)); return 1; } - if (c >= '\0' && c <= '\u001f') { + if (c < ' ') { sb.append('\0'); //Shift 1 Set sb.append(c); return 2; @@ -57,7 +57,7 @@ final class TextEncoder extends C40Encoder { sb.append((char) (c - 91 + 22)); return 2; } - if (c == '\u0060') { + if (c == '`') { sb.append('\2'); //Shift 3 Set sb.append((char) (c - 96)); return 2; @@ -67,19 +67,15 @@ final class TextEncoder extends C40Encoder { sb.append((char) (c - 65 + 1)); return 2; } - if (c >= '{' && c <= '\u007f') { + if (c >= '{' && c <= 127) { sb.append('\2'); //Shift 3 Set sb.append((char) (c - 123 + 27)); return 2; } - if (c >= '\u0080') { - sb.append("\1\u001e"); //Shift 2, Upper Shift - int len = 2; - len += encodeChar((char) (c - 128), sb); - return len; - } - HighLevelEncoder.illegalCharacter(c); - return -1; + sb.append("\1\u001e"); //Shift 2, Upper Shift + int len = 2; + len += encodeChar((char) (c - 128), sb); + return len; } } diff --git a/core/src/main/java/com/google/zxing/maxicode/MaxiCodeReader.java b/core/src/main/java/com/google/zxing/maxicode/MaxiCodeReader.java index a9134e37d..1d430333a 100644 --- a/core/src/main/java/com/google/zxing/maxicode/MaxiCodeReader.java +++ b/core/src/main/java/com/google/zxing/maxicode/MaxiCodeReader.java @@ -43,12 +43,6 @@ public final class MaxiCodeReader implements Reader { private final Decoder decoder = new Decoder(); - /* - Decoder getDecoder() { - return decoder; - } - */ - /** * Locates and decodes a MaxiCode in an image. * diff --git a/core/src/main/java/com/google/zxing/oned/Code39Writer.java b/core/src/main/java/com/google/zxing/oned/Code39Writer.java index 94a22ba15..75bf74a94 100644 --- a/core/src/main/java/com/google/zxing/oned/Code39Writer.java +++ b/core/src/main/java/com/google/zxing/oned/Code39Writer.java @@ -117,29 +117,29 @@ public final class Code39Writer extends OneDimensionalCodeWriter { extendedContent.append("%W"); break; default: - if (character > 0 && character < 27) { + if (character <= 26) { extendedContent.append('$'); extendedContent.append((char) ('A' + (character - 1))); - } else if (character > 26 && character < ' ') { + } else if (character < ' ') { extendedContent.append('%'); extendedContent.append((char) ('A' + (character - 27))); - } else if ((character > ' ' && character < '-') || character == '/' || character == ':') { + } else if (character <= ',' || character == '/' || character == ':') { extendedContent.append('/'); extendedContent.append((char) ('A' + (character - 33))); - } else if (character > '/' && character < ':') { + } else if (character <= '9') { extendedContent.append((char) ('0' + (character - 48))); - } else if (character > ':' && character < '@') { + } else if (character <= '?') { extendedContent.append('%'); extendedContent.append((char) ('F' + (character - 59))); - } else if (character > '@' && character < '[') { + } else if (character <= 'Z') { extendedContent.append((char) ('A' + (character - 65))); - } else if (character > 'Z' && character < '`') { + } else if (character <= '_') { extendedContent.append('%'); extendedContent.append((char) ('K' + (character - 91))); - } else if (character > '`' && character < '{') { + } else if (character <= 'z') { extendedContent.append('+'); extendedContent.append((char) ('A' + (character - 97))); - } else if (character > 'z' && character < 128) { + } else if (character <= 127) { extendedContent.append('%'); extendedContent.append((char) ('P' + (character - 123))); } else { diff --git a/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java b/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java index 10ae91a7f..8e226c337 100644 --- a/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java +++ b/core/src/main/java/com/google/zxing/oned/rss/expanded/RSSExpandedReader.java @@ -145,15 +145,16 @@ public final class RSSExpandedReader extends AbstractRSSReader { // Not private for testing List decodeRow2pairs(int rowNumber, BitArray row) throws NotFoundException { - try { - while (true) { - ExpandedPair nextPair = retrieveNextPair(row, this.pairs, rowNumber); - this.pairs.add(nextPair); + boolean done = false; + while (!done) { + try { + this.pairs.add(retrieveNextPair(row, this.pairs, rowNumber)); + } catch (NotFoundException nfe) { + if (this.pairs.isEmpty()) { + throw nfe; + } // exit this loop when retrieveNextPair() fails and throws - } - } catch (NotFoundException nfe) { - if (this.pairs.isEmpty()) { - throw nfe; + done = true; } } @@ -227,8 +228,7 @@ public final class RSSExpandedReader extends AbstractRSSReader { return this.pairs; } - List rs = new ArrayList<>(); - rs.addAll(collectedRows); + List rs = new ArrayList<>(collectedRows); rs.add(row); try { // Recursion: try to add more rows diff --git a/core/src/main/java/com/google/zxing/pdf417/decoder/BoundingBox.java b/core/src/main/java/com/google/zxing/pdf417/decoder/BoundingBox.java index b77314560..67fd990ac 100644 --- a/core/src/main/java/com/google/zxing/pdf417/decoder/BoundingBox.java +++ b/core/src/main/java/com/google/zxing/pdf417/decoder/BoundingBox.java @@ -25,15 +25,15 @@ import com.google.zxing.common.BitMatrix; */ final class BoundingBox { - private BitMatrix image; - private ResultPoint topLeft; - private ResultPoint bottomLeft; - private ResultPoint topRight; - private ResultPoint bottomRight; - private int minX; - private int maxX; - private int minY; - private int maxY; + private final BitMatrix image; + private final ResultPoint topLeft; + private final ResultPoint bottomLeft; + private final ResultPoint topRight; + private final ResultPoint bottomRight; + private final int minX; + private final int maxX; + private final int minY; + private final int maxY; BoundingBox(BitMatrix image, ResultPoint topLeft, @@ -46,24 +46,34 @@ final class BoundingBox { (topRight != null && bottomRight == null)) { throw NotFoundException.getNotFoundInstance(); } - init(image, topLeft, bottomLeft, topRight, bottomRight); - } - - BoundingBox(BoundingBox boundingBox) { - init(boundingBox.image, boundingBox.topLeft, boundingBox.bottomLeft, boundingBox.topRight, boundingBox.bottomRight); - } - - private void init(BitMatrix image, - ResultPoint topLeft, - ResultPoint bottomLeft, - ResultPoint topRight, - ResultPoint bottomRight) { + if (topLeft == null) { + topLeft = new ResultPoint(0, topRight.getY()); + bottomLeft = new ResultPoint(0, bottomRight.getY()); + } else if (topRight == null) { + topRight = new ResultPoint(image.getWidth() - 1, topLeft.getY()); + bottomRight = new ResultPoint(image.getWidth() - 1, bottomLeft.getY()); + } this.image = image; this.topLeft = topLeft; this.bottomLeft = bottomLeft; this.topRight = topRight; this.bottomRight = bottomRight; - calculateMinMaxValues(); + this.minX = (int) Math.min(topLeft.getX(), bottomLeft.getX()); + this.maxX = (int) Math.max(topRight.getX(), bottomRight.getX()); + this.minY = (int) Math.min(topLeft.getY(), topRight.getY()); + this.maxY = (int) Math.max(bottomLeft.getY(), bottomRight.getY()); + } + + BoundingBox(BoundingBox boundingBox) { + this.image = boundingBox.image; + this.topLeft = boundingBox.getTopLeft(); + this.bottomLeft = boundingBox.getBottomLeft(); + this.topRight = boundingBox.getTopRight(); + this.bottomRight = boundingBox.getBottomRight(); + this.minX = boundingBox.getMinX(); + this.maxX = boundingBox.getMaxX(); + this.minY = boundingBox.getMinY(); + this.maxY = boundingBox.getMaxY(); } static BoundingBox merge(BoundingBox leftBox, BoundingBox rightBox) throws NotFoundException { @@ -110,37 +120,9 @@ final class BoundingBox { } } - calculateMinMaxValues(); return new BoundingBox(image, newTopLeft, newBottomLeft, newTopRight, newBottomRight); } - private void calculateMinMaxValues() { - if (topLeft == null) { - topLeft = new ResultPoint(0, topRight.getY()); - bottomLeft = new ResultPoint(0, bottomRight.getY()); - } else if (topRight == null) { - topRight = new ResultPoint(image.getWidth() - 1, topLeft.getY()); - bottomRight = new ResultPoint(image.getWidth() - 1, bottomLeft.getY()); - } - - minX = (int) Math.min(topLeft.getX(), bottomLeft.getX()); - maxX = (int) Math.max(topRight.getX(), bottomRight.getX()); - minY = (int) Math.min(topLeft.getY(), topRight.getY()); - maxY = (int) Math.max(bottomLeft.getY(), bottomRight.getY()); - } - - /* - void setTopRight(ResultPoint topRight) { - this.topRight = topRight; - calculateMinMaxValues(); - } - - void setBottomRight(ResultPoint bottomRight) { - this.bottomRight = bottomRight; - calculateMinMaxValues(); - } - */ - int getMinX() { return minX; } diff --git a/core/src/main/java/com/google/zxing/qrcode/decoder/Decoder.java b/core/src/main/java/com/google/zxing/qrcode/decoder/Decoder.java index 9519687bb..7fcb7d2b0 100644 --- a/core/src/main/java/com/google/zxing/qrcode/decoder/Decoder.java +++ b/core/src/main/java/com/google/zxing/qrcode/decoder/Decoder.java @@ -123,11 +123,7 @@ public final class Decoder { if (fe != null) { throw fe; } - if (ce != null) { - throw ce; - } - throw e; - + throw ce; // If fe is null, this can't be } } diff --git a/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java b/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java index a2b94cf73..d32744335 100755 --- a/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java +++ b/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java @@ -256,9 +256,6 @@ public class FinderPatternFinder { * * @param centerI row where a finder pattern was detected * @param centerJ center of the section that appears to cross a finder pattern - * @param maxCount maximum reasonable number of modules that should be - * observed in any reading state, based on the results of the horizontal scan - * @param originalStateCountTotal The original state count total. * @return true if proportions are withing expected limits */ private boolean crossCheckDiagonal(int centerI, int centerJ) { diff --git a/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java b/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java index 23543dd90..6314eb6cf 100644 --- a/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java +++ b/core/src/main/java/com/google/zxing/qrcode/encoder/Encoder.java @@ -92,7 +92,7 @@ public final class Encoder { BitArray headerBits = new BitArray(); // Append ECI segment if applicable - if (mode == Mode.BYTE && (hasEncodingHint || !DEFAULT_BYTE_MODE_ENCODING.equals(encoding))) { + if (mode == Mode.BYTE && hasEncodingHint) { CharacterSetECI eci = CharacterSetECI.getCharacterSetECIByName(encoding); if (eci != null) { appendECI(eci, headerBits); diff --git a/core/src/test/java/com/google/zxing/PlanarYUVLuminanceSourceTestCase.java b/core/src/test/java/com/google/zxing/PlanarYUVLuminanceSourceTestCase.java index 5325af090..e48c4a238 100644 --- a/core/src/test/java/com/google/zxing/PlanarYUVLuminanceSourceTestCase.java +++ b/core/src/test/java/com/google/zxing/PlanarYUVLuminanceSourceTestCase.java @@ -19,6 +19,9 @@ package com.google.zxing; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link PlanarYUVLuminanceSource}. + */ public final class PlanarYUVLuminanceSourceTestCase extends Assert { private static final byte[] YUV = { diff --git a/core/src/test/java/com/google/zxing/RGBLuminanceSourceTestCase.java b/core/src/test/java/com/google/zxing/RGBLuminanceSourceTestCase.java index dace0fae6..97f9794e1 100644 --- a/core/src/test/java/com/google/zxing/RGBLuminanceSourceTestCase.java +++ b/core/src/test/java/com/google/zxing/RGBLuminanceSourceTestCase.java @@ -19,6 +19,9 @@ package com.google.zxing; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link RGBLuminanceSource}. + */ public final class RGBLuminanceSourceTestCase extends Assert { private static final RGBLuminanceSource SOURCE = new RGBLuminanceSource(3, 3, new int[] { diff --git a/core/src/test/java/com/google/zxing/aztec/decoder/DecoderTest.java b/core/src/test/java/com/google/zxing/aztec/decoder/DecoderTest.java index 9b07966b2..9cca45a0f 100644 --- a/core/src/test/java/com/google/zxing/aztec/decoder/DecoderTest.java +++ b/core/src/test/java/com/google/zxing/aztec/decoder/DecoderTest.java @@ -23,6 +23,9 @@ import com.google.zxing.common.DecoderResult; import org.junit.Test; import org.junit.Assert; +/** + * Tests {@link Decoder}. + */ public final class DecoderTest extends Assert { private static final ResultPoint[] NO_POINTS = new ResultPoint[0]; diff --git a/core/src/test/java/com/google/zxing/aztec/encoder/EncoderTest.java b/core/src/test/java/com/google/zxing/aztec/encoder/EncoderTest.java index d92b82969..fd3746fbb 100644 --- a/core/src/test/java/com/google/zxing/aztec/encoder/EncoderTest.java +++ b/core/src/test/java/com/google/zxing/aztec/encoder/EncoderTest.java @@ -51,7 +51,7 @@ public final class EncoderTest extends Assert { // real life tests @Test - public void testEncode1() throws Exception { + public void testEncode1() { testEncode("This is an example Aztec symbol for Wikipedia.", true, 3, "X X X X X X X X \n" + "X X X X X X X X X X \n" + @@ -79,7 +79,7 @@ public final class EncoderTest extends Assert { } @Test - public void testEncode2() throws Exception { + public void testEncode2() { testEncode("Aztec Code is a public domain 2D matrix barcode symbology" + " of nominally square symbols built on a square grid with a " + "distinctive square bullseye pattern at their center.", false, 6, @@ -279,7 +279,7 @@ public final class EncoderTest extends Assert { } @Test - public void testHighLevelEncode() throws Exception { + public void testHighLevelEncode() { testHighLevelEncodeString("A. b.", // 'A' P/S '. ' L/L b D/L '.' "...X. ..... ...XX XXX.. ...XX XXXX. XX.X"); @@ -309,7 +309,7 @@ public final class EncoderTest extends Assert { } @Test - public void testHighLevelEncodeBinary() throws Exception { + public void testHighLevelEncodeBinary() { // binary short form single byte testHighLevelEncodeString("N\0N", // 'N' B/S =1 '\0' N @@ -338,7 +338,7 @@ public final class EncoderTest extends Assert { // Create a string in which every character requires binary StringBuilder sb = new StringBuilder(); for (int i = 0; i <= 3000; i++) { - sb.append((char)(128 + (i % 30))); + sb.append((char) (128 + (i % 30))); } // Test the output generated by Binary/Switch, particularly near the // places where the encoding changes: 31, 62, and 2047+31=2078 @@ -346,7 +346,7 @@ public final class EncoderTest extends Assert { 60, 61, 62, 63, 64, 2076, 2077, 2078, 2079, 2080, 2100 }) { // This is the expected length of a binary string of length "i" int expectedLength = (8 * i) + - ( (i <= 31) ? 10 : (i <= 62) ? 20 : (i <= 2078) ? 21 : 31); + ((i <= 31) ? 10 : (i <= 62) ? 20 : (i <= 2078) ? 21 : 31); // Verify that we are correct about the length. testHighLevelEncodeString(sb.substring(0, i), expectedLength); if (i != 1 && i != 32 && i != 2079) { @@ -364,7 +364,7 @@ public final class EncoderTest extends Assert { } @Test - public void testHighLevelEncodePairs() throws Exception { + public void testHighLevelEncodePairs() { // Typical usage testHighLevelEncodeString("ABC. DEF\r\n", // A B C P/S . D E F P/S \r\n @@ -387,7 +387,7 @@ public final class EncoderTest extends Assert { } @Test - public void testUserSpecifiedLayers() throws Exception { + public void testUserSpecifiedLayers() { byte[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".getBytes(StandardCharsets.ISO_8859_1); AztecCode aztec = Encoder.encode(alphabet, 25, -2); assertEquals(2, aztec.getLayers()); @@ -413,7 +413,7 @@ public final class EncoderTest extends Assert { } @Test - public void testBorderCompact4Case() throws Exception { + public void testBorderCompact4Case() { // Compact(4) con hold 608 bits of information, but at most 504 can be data. Rest must // be error correction String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -441,7 +441,7 @@ public final class EncoderTest extends Assert { // Helper routines - private static void testEncode(String data, boolean compact, int layers, String expected) throws Exception { + private static void testEncode(String data, boolean compact, int layers, String expected) { AztecCode aztec = Encoder.encode(data.getBytes(StandardCharsets.ISO_8859_1), 33, Encoder.DEFAULT_AZTEC_LAYERS); assertEquals("Unexpected symbol format (compact)", compact, aztec.isCompact()); assertEquals("Unexpected nr. of layers", layers, aztec.getLayers()); diff --git a/core/src/test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java b/core/src/test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java index ade50faae..861e6636f 100644 --- a/core/src/test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java +++ b/core/src/test/java/com/google/zxing/client/result/ExpandedProductParsedResultTestCase.java @@ -41,7 +41,7 @@ import java.util.Map; public final class ExpandedProductParsedResultTestCase extends Assert { @Test - public void test_RSSExpanded() { + public void testRSSExpanded() { Map uncommonAIs = new HashMap<>(); uncommonAIs.put("123", "544654"); Result result = diff --git a/core/src/test/java/com/google/zxing/client/result/VINParsedResultTestCase.java b/core/src/test/java/com/google/zxing/client/result/VINParsedResultTestCase.java index 0a3442641..1897736bc 100644 --- a/core/src/test/java/com/google/zxing/client/result/VINParsedResultTestCase.java +++ b/core/src/test/java/com/google/zxing/client/result/VINParsedResultTestCase.java @@ -22,6 +22,9 @@ import com.google.zxing.Result; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link VINParsedResult}. + */ public final class VINParsedResultTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java b/core/src/test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java index c5129ee9c..413d21497 100644 --- a/core/src/test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java +++ b/core/src/test/java/com/google/zxing/common/AbstractBlackBoxTestCase.java @@ -322,7 +322,7 @@ public abstract class AbstractBlackBoxTestCase extends Assert { return original; } - switch(original.getType()) { + switch (original.getType()) { case BufferedImage.TYPE_BYTE_INDEXED: case BufferedImage.TYPE_BYTE_BINARY: BufferedImage argb = new BufferedImage(original.getWidth(), diff --git a/core/src/test/java/com/google/zxing/common/StringUtilsTestCase.java b/core/src/test/java/com/google/zxing/common/StringUtilsTestCase.java index bbe3c8090..578843b1e 100644 --- a/core/src/test/java/com/google/zxing/common/StringUtilsTestCase.java +++ b/core/src/test/java/com/google/zxing/common/StringUtilsTestCase.java @@ -21,22 +21,25 @@ import org.junit.Test; import java.nio.charset.Charset; +/** + * Tests {@link StringUtils}. + */ public final class StringUtilsTestCase extends Assert { @Test - public void testShortShiftJIS_1() { + public void testShortShiftJIS1() { // ÈáëÈ≠ö doTest(new byte[] { (byte) 0x8b, (byte) 0xe0, (byte) 0x8b, (byte) 0x9b, }, "SJIS"); } @Test - public void testShortISO88591_1() { + public void testShortISO885911() { // b√•d doTest(new byte[] { (byte) 0x62, (byte) 0xe5, (byte) 0x64, }, "ISO-8859-1"); } @Test - public void testMixedShiftJIS_1() { + public void testMixedShiftJIS1() { // Hello Èáë! doTest(new byte[] { (byte) 0x48, (byte) 0x65, (byte) 0x6c, (byte) 0x6c, (byte) 0x6f, (byte) 0x20, (byte) 0x8b, (byte) 0xe0, (byte) 0x21, }, diff --git a/core/src/test/java/com/google/zxing/common/TestResult.java b/core/src/test/java/com/google/zxing/common/TestResult.java index 313c5c6ae..cc1ad5206 100644 --- a/core/src/test/java/com/google/zxing/common/TestResult.java +++ b/core/src/test/java/com/google/zxing/common/TestResult.java @@ -16,6 +16,9 @@ package com.google.zxing.common; +/** + * Encapsulates the result of one test over a batch of black-box images. + */ public final class TestResult { private final int mustPassCount; diff --git a/core/src/test/java/com/google/zxing/common/detector/MathUtilsTestCase.java b/core/src/test/java/com/google/zxing/common/detector/MathUtilsTestCase.java index 18f364cc9..03c8a55fb 100644 --- a/core/src/test/java/com/google/zxing/common/detector/MathUtilsTestCase.java +++ b/core/src/test/java/com/google/zxing/common/detector/MathUtilsTestCase.java @@ -19,6 +19,9 @@ package com.google.zxing.common.detector; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link MathUtils}. + */ public final class MathUtilsTestCase extends Assert { private static final float EPSILON = 1.0E-8f; diff --git a/core/src/test/java/com/google/zxing/common/reedsolomon/ReedSolomonTestCase.java b/core/src/test/java/com/google/zxing/common/reedsolomon/ReedSolomonTestCase.java index 0ac768238..834433b10 100644 --- a/core/src/test/java/com/google/zxing/common/reedsolomon/ReedSolomonTestCase.java +++ b/core/src/test/java/com/google/zxing/common/reedsolomon/ReedSolomonTestCase.java @@ -493,7 +493,7 @@ public final class ReedSolomonTestCase extends Assert { private static String arrayToString(int[] data) { StringBuilder sb = new StringBuilder("{"); - for (int i=0; i 0 ? ",%X" : "%X", data[i])); } return sb.append('}').toString(); diff --git a/core/src/test/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParserTestCase.java b/core/src/test/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParserTestCase.java index 444d30ccd..a0bbc58d3 100644 --- a/core/src/test/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParserTestCase.java +++ b/core/src/test/java/com/google/zxing/datamatrix/decoder/DecodedBitStreamParserTestCase.java @@ -34,9 +34,9 @@ public final class DecodedBitStreamParserTestCase extends Assert { } @Test - public void testAsciiDoubleDigitDecode() throws Exception{ + public void testAsciiDoubleDigitDecode() throws Exception { // ASCII double digit (00 - 99) Numeric Value + 130 - byte[] bytes = {(byte) 130 , (byte) ( 1 + 130), + byte[] bytes = {(byte) 130 , (byte) (1 + 130), (byte) (98 + 130), (byte) (99 + 130)}; String decodedString = DecodedBitStreamParser.decode(bytes).getText(); assertEquals("00019899", decodedString); diff --git a/core/src/test/java/com/google/zxing/maxicode/Maxicode1TestCase.java b/core/src/test/java/com/google/zxing/maxicode/Maxicode1TestCase.java index dfab4ad7b..52927ca0c 100644 --- a/core/src/test/java/com/google/zxing/maxicode/Maxicode1TestCase.java +++ b/core/src/test/java/com/google/zxing/maxicode/Maxicode1TestCase.java @@ -20,6 +20,9 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * Tests {@link MaxiCodeReader} against a fixed set of test images. + */ public final class Maxicode1TestCase extends AbstractBlackBoxTestCase { public Maxicode1TestCase() { diff --git a/core/src/test/java/com/google/zxing/multi/MultiTestCase.java b/core/src/test/java/com/google/zxing/multi/MultiTestCase.java index 9497698d5..58be12b1f 100644 --- a/core/src/test/java/com/google/zxing/multi/MultiTestCase.java +++ b/core/src/test/java/com/google/zxing/multi/MultiTestCase.java @@ -31,6 +31,9 @@ import com.google.zxing.common.HybridBinarizer; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link MultipleBarcodeReader}. + */ public final class MultiTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java b/core/src/test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java index 3b5f4400d..7ef2286c5 100644 --- a/core/src/test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java +++ b/core/src/test/java/com/google/zxing/multi/qrcode/MultiQRCodeTestCase.java @@ -35,6 +35,9 @@ import com.google.zxing.multi.MultipleBarcodeReader; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link QRCodeMultiReader}. + */ public final class MultiQRCodeTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/oned/Code128WriterTestCase.java b/core/src/test/java/com/google/zxing/oned/Code128WriterTestCase.java index 7a667ae4e..f29d87c51 100644 --- a/core/src/test/java/com/google/zxing/oned/Code128WriterTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/Code128WriterTestCase.java @@ -28,6 +28,9 @@ import com.google.zxing.WriterException; import com.google.zxing.common.BitArray; import com.google.zxing.common.BitMatrix; +/** + * Tests {@link Code128Writer}. + */ public class Code128WriterTestCase extends Assert { private static final String FNC1 = "11110101110"; diff --git a/core/src/test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java b/core/src/test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java index e3b795c4b..5ed505692 100644 --- a/core/src/test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/Code39ExtendedModeTestCase.java @@ -32,7 +32,7 @@ import com.google.zxing.Result; public final class Code39ExtendedModeTestCase extends Assert { @Test - public void testDecodeExtendedMode() throws FormatException, ChecksumException, NotFoundException { + public void testDecodeExtendedMode() throws Exception { doTest("\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f", "000001001011011010101001001001011001010101101001001001010110101001011010010010010101011010010110100100100101011011010010101001001001010101011001011010010010010101101011001010100100100101010110110010101001001001010101010011011010010010010101101010011010100100100101010110100110101001001001010101011001101010010010010101101010100110100100100101010110101001101001001001010110110101001010010010010101010110100110100100100101011010110100101001001001010101101101001010010010010101010101100110100100100101011010101100101001001001010101101011001010010010010101010110110010100100100101011001010101101001001001010100110101011010010010010101100110101010100100100101010010110101101001001001010110010110101010010010010101001101101010101001001001011010100101101010010010010101101001011010100100100101101101001010101001001001010101100101101010010010010110101100101010010110110100000"); doTest(" !\"#$%&'()*+,-./0123456789:;<=>?", diff --git a/core/src/test/java/com/google/zxing/oned/Code39WriterTestCase.java b/core/src/test/java/com/google/zxing/oned/Code39WriterTestCase.java index bbf7de8f6..1872e9689 100644 --- a/core/src/test/java/com/google/zxing/oned/Code39WriterTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/Code39WriterTestCase.java @@ -23,6 +23,9 @@ import com.google.zxing.common.BitMatrixTestCase; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link Code39Writer}. + */ public final class Code39WriterTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/oned/Code93WriterTestCase.java b/core/src/test/java/com/google/zxing/oned/Code93WriterTestCase.java index e081f1577..baf007990 100644 --- a/core/src/test/java/com/google/zxing/oned/Code93WriterTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/Code93WriterTestCase.java @@ -23,6 +23,9 @@ import com.google.zxing.common.BitMatrixTestCase; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link Code93Writer}. + */ public final class Code93WriterTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/oned/ITFWriterTestCase.java b/core/src/test/java/com/google/zxing/oned/ITFWriterTestCase.java index 7c437d661..56842b241 100644 --- a/core/src/test/java/com/google/zxing/oned/ITFWriterTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/ITFWriterTestCase.java @@ -23,6 +23,9 @@ import com.google.zxing.common.BitMatrixTestCase; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link ITFWriter}. + */ public final class ITFWriterTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/oned/UPCEWriterTestCase.java b/core/src/test/java/com/google/zxing/oned/UPCEWriterTestCase.java index 70c8b6ffb..dd7db3f74 100644 --- a/core/src/test/java/com/google/zxing/oned/UPCEWriterTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/UPCEWriterTestCase.java @@ -23,6 +23,9 @@ import com.google.zxing.common.BitMatrixTestCase; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link UPCEWriter}. + */ public final class UPCEWriterTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox1TestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox1TestCase.java index d8007bb85..2072004c4 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox1TestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox1TestCase.java @@ -30,6 +30,9 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * A test of {@link RSSExpandedReader} against a fixed test set of images. + */ public final class RSSExpandedBlackBox1TestCase extends AbstractBlackBoxTestCase { public RSSExpandedBlackBox1TestCase() { diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox2TestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox2TestCase.java index 948f30299..515179ec6 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox2TestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox2TestCase.java @@ -30,6 +30,9 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * A test of {@link RSSExpandedReader} against a fixed test set of images. + */ public final class RSSExpandedBlackBox2TestCase extends AbstractBlackBoxTestCase { public RSSExpandedBlackBox2TestCase() { diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox3TestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox3TestCase.java index 74fa508ad..002ce6973 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox3TestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedBlackBox3TestCase.java @@ -30,6 +30,9 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * A test of {@link RSSExpandedReader} against a fixed test set of images. + */ public final class RSSExpandedBlackBox3TestCase extends AbstractBlackBoxTestCase { public RSSExpandedBlackBox3TestCase() { diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java index 92001fd7e..fa56ea1ad 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2binaryTestCase.java @@ -50,124 +50,124 @@ import org.junit.Test; public final class RSSExpandedImage2binaryTestCase extends Assert { @Test - public void testDecodeRow2binary_1() throws Exception { + public void testDecodeRow2binary1() throws Exception { // (11)100224(17)110224(3102)000100 assertCorrectImage2binary( "1.png", " ...X...X .X....X. .XX...X. X..X...X ...XX.X. ..X.X... ..X.X..X ...X..X. X.X....X .X....X. .....X.. X...X..."); } @Test - public void testDecodeRow2binary_2() throws Exception { + public void testDecodeRow2binary2() throws Exception { // (01)90012345678908(3103)001750 assertCorrectImage2binary("2.png", " ..X..... ......X. .XXX.X.X .X...XX. XXXXX.XX XX.X.... .XX.XX.X .XX."); } @Test - public void testDecodeRow2binary_3() throws Exception { + public void testDecodeRow2binary3() throws Exception { // (10)12A assertCorrectImage2binary("3.png", " .......X ..XX..X. X.X....X .......X ...."); } @Test - public void testDecodeRow2binary_4() throws Exception { + public void testDecodeRow2binary4() throws Exception { // (01)98898765432106(3202)012345(15)991231 assertCorrectImage2binary( "4.png", " ..XXXX.X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX..XX XX.X.XXX X..XX..X .X.XXXXX XXXX"); } @Test - public void testDecodeRow2binary_5() throws Exception { + public void testDecodeRow2binary5() throws Exception { // (01)90614141000015(3202)000150 assertCorrectImage2binary( "5.png", " ..X.X... .XXXX.X. XX..XXXX ....XX.. X....... ....X... ....X..X .XX."); } @Test - public void testDecodeRow2binary_10() throws Exception { + public void testDecodeRow2binary10() throws Exception { // (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456(423)0123456789012 assertCorrectImage2binary( "10.png", " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... XX.XX..X .X..X..X .X.X.X.X X.XX...X .XX.XXX. XXX.X.XX ..X."); } @Test - public void testDecodeRow2binary_11() throws Exception { + public void testDecodeRow2binary11() throws Exception { // (01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456 assertCorrectImage2binary( "11.png", " .X.XX..X XX.XXXX. .XXX.XX. XX..X... .XXXXX.. XX.X..X. ..XX...X XX.X.... X.X.X.X. X.X..X.X .X....X. XX...X.. ...XX.X. .XXXXXX. .X..XX.. X.X.X... .X...... XXXX.... XX.XX... XXXXX.X. ...XXXXX .....X.X ...X.... X.XXX..X X.X.X... ...."); } @Test - public void testDecodeRow2binary_12() throws Exception { + public void testDecodeRow2binary12() throws Exception { // (01)98898765432106(3103)001750 assertCorrectImage2binary( "12.png", " ..X..XX. XXXX..XX X.XX.XX. .X....XX XXX..XX. X..X.... .XX.XX.X .XX."); } @Test - public void testDecodeRow2binary_13() throws Exception { + public void testDecodeRow2binary13() throws Exception { // (01)90012345678908(3922)795 assertCorrectImage2binary( "13.png", " ..XX..X. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. X.X.XXXX .X..X..X ......X."); } @Test - public void testDecodeRow2binary_14() throws Exception { + public void testDecodeRow2binary14() throws Exception { // (01)90012345678908(3932)0401234 assertCorrectImage2binary( "14.png", " ..XX.X.. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. X.....X. X.....X. X.X.X.XX .X...... X..."); } @Test - public void testDecodeRow2binary_15() throws Exception { + public void testDecodeRow2binary15() throws Exception { // (01)90012345678908(3102)001750(11)100312 assertCorrectImage2binary( "15.png", " ..XXX... ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_16() throws Exception { + public void testDecodeRow2binary16() throws Exception { // (01)90012345678908(3202)001750(11)100312 assertCorrectImage2binary( "16.png", " ..XXX..X ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_17() throws Exception { + public void testDecodeRow2binary17() throws Exception { // (01)90012345678908(3102)001750(13)100312 assertCorrectImage2binary( "17.png", " ..XXX.X. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_18() throws Exception { + public void testDecodeRow2binary18() throws Exception { // (01)90012345678908(3202)001750(13)100312 assertCorrectImage2binary( "18.png", " ..XXX.XX ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_19() throws Exception { + public void testDecodeRow2binary19() throws Exception { // (01)90012345678908(3102)001750(15)100312 assertCorrectImage2binary( "19.png", " ..XXXX.. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_20() throws Exception { + public void testDecodeRow2binary20() throws Exception { // (01)90012345678908(3202)001750(15)100312 assertCorrectImage2binary( "20.png", " ..XXXX.X ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_21() throws Exception { + public void testDecodeRow2binary21() throws Exception { // (01)90012345678908(3102)001750(17)100312 assertCorrectImage2binary( "21.png", " ..XXXXX. ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); } @Test - public void testDecodeRow2binary_22() throws Exception { + public void testDecodeRow2binary22() throws Exception { // (01)90012345678908(3202)001750(17)100312 assertCorrectImage2binary( "22.png", " ..XXXXXX ........ .X..XXX. X.X.X... XX.XXXXX .XXXX.X. ..XX...X .X.....X .XX..... XXXX.X.. XX.."); diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java index 776b9c291..db95cae15 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2resultTestCase.java @@ -61,7 +61,7 @@ import org.junit.Test; public final class RSSExpandedImage2resultTestCase extends Assert { @Test - public void testDecodeRow2result_2() throws Exception { + public void testDecodeRow2result2() throws Exception { // (01)90012345678908(3103)001750 ExpandedProductParsedResult expected = new ExpandedProductParsedResult("(01)90012345678908(3103)001750", diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java index d99f86696..5a0656ed8 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedImage2stringTestCase.java @@ -51,138 +51,138 @@ import org.junit.Test; public final class RSSExpandedImage2stringTestCase extends Assert { @Test - public void testDecodeRow2string_1() throws Exception { + public void testDecodeRow2string1() throws Exception { assertCorrectImage2string("1.png", "(11)100224(17)110224(3102)000100"); } @Test - public void testDecodeRow2string_2() throws Exception { + public void testDecodeRow2string2() throws Exception { assertCorrectImage2string("2.png", "(01)90012345678908(3103)001750"); } @Test - public void testDecodeRow2string_3() throws Exception { + public void testDecodeRow2string3() throws Exception { assertCorrectImage2string("3.png", "(10)12A"); } @Test - public void testDecodeRow2string_4() throws Exception { + public void testDecodeRow2string4() throws Exception { assertCorrectImage2string("4.png", "(01)98898765432106(3202)012345(15)991231"); } @Test - public void testDecodeRow2string_5() throws Exception { + public void testDecodeRow2string5() throws Exception { assertCorrectImage2string("5.png", "(01)90614141000015(3202)000150"); } @Test - public void testDecodeRow2string_7() throws Exception { + public void testDecodeRow2string7() throws Exception { assertCorrectImage2string("7.png", "(10)567(11)010101"); } @Test - public void testDecodeRow2string_10() throws Exception { + public void testDecodeRow2string10() throws Exception { String expected = "(01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456(423)012345678901"; assertCorrectImage2string("10.png", expected); } @Test - public void testDecodeRow2string_11() throws Exception { + public void testDecodeRow2string11() throws Exception { assertCorrectImage2string("11.png", "(01)98898765432106(15)991231(3103)001750(10)12A(422)123(21)123456"); } @Test - public void testDecodeRow2string_12() throws Exception { + public void testDecodeRow2string12() throws Exception { assertCorrectImage2string("12.png", "(01)98898765432106(3103)001750"); } @Test - public void testDecodeRow2string_13() throws Exception { + public void testDecodeRow2string13() throws Exception { assertCorrectImage2string("13.png", "(01)90012345678908(3922)795"); } @Test - public void testDecodeRow2string_14() throws Exception { + public void testDecodeRow2string14() throws Exception { assertCorrectImage2string("14.png", "(01)90012345678908(3932)0401234"); } @Test - public void testDecodeRow2string_15() throws Exception { + public void testDecodeRow2string15() throws Exception { assertCorrectImage2string("15.png", "(01)90012345678908(3102)001750(11)100312"); } @Test - public void testDecodeRow2string_16() throws Exception { + public void testDecodeRow2string16() throws Exception { assertCorrectImage2string("16.png", "(01)90012345678908(3202)001750(11)100312"); } @Test - public void testDecodeRow2string_17() throws Exception { + public void testDecodeRow2string17() throws Exception { assertCorrectImage2string("17.png", "(01)90012345678908(3102)001750(13)100312"); } @Test - public void testDecodeRow2string_18() throws Exception { + public void testDecodeRow2string18() throws Exception { assertCorrectImage2string("18.png", "(01)90012345678908(3202)001750(13)100312"); } @Test - public void testDecodeRow2string_19() throws Exception { + public void testDecodeRow2string19() throws Exception { assertCorrectImage2string("19.png", "(01)90012345678908(3102)001750(15)100312"); } @Test - public void testDecodeRow2string_20() throws Exception { + public void testDecodeRow2string20() throws Exception { assertCorrectImage2string("20.png", "(01)90012345678908(3202)001750(15)100312"); } @Test - public void testDecodeRow2string_21() throws Exception { + public void testDecodeRow2string21() throws Exception { assertCorrectImage2string("21.png", "(01)90012345678908(3102)001750(17)100312"); } @Test - public void testDecodeRow2string_22() throws Exception { + public void testDecodeRow2string22() throws Exception { assertCorrectImage2string("22.png", "(01)90012345678908(3202)001750(17)100312"); } @Test - public void testDecodeRow2string_25() throws Exception { + public void testDecodeRow2string25() throws Exception { assertCorrectImage2string("25.png", "(10)123"); } @Test - public void testDecodeRow2string_26() throws Exception { + public void testDecodeRow2string26() throws Exception { assertCorrectImage2string("26.png", "(10)5678(11)010101"); } @Test - public void testDecodeRow2string_27() throws Exception { + public void testDecodeRow2string27() throws Exception { assertCorrectImage2string("27.png", "(10)1098-1234"); } @Test - public void testDecodeRow2string_28() throws Exception { + public void testDecodeRow2string28() throws Exception { assertCorrectImage2string("28.png", "(10)1098/1234"); } @Test - public void testDecodeRow2string_29() throws Exception { + public void testDecodeRow2string29() throws Exception { assertCorrectImage2string("29.png", "(10)1098.1234"); } @Test - public void testDecodeRow2string_30() throws Exception { + public void testDecodeRow2string30() throws Exception { assertCorrectImage2string("30.png", "(10)1098*1234"); } @Test - public void testDecodeRow2string_31() throws Exception { + public void testDecodeRow2string31() throws Exception { assertCorrectImage2string("31.png", "(10)1098,1234"); } @Test - public void testDecodeRow2string_32() throws Exception { + public void testDecodeRow2string32() throws Exception { assertCorrectImage2string("32.png", "(15)991231(3103)001750(10)12A(422)123(21)123456(423)0123456789012"); } diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedInternalTestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedInternalTestCase.java index af63d7f33..34ccdc3e0 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedInternalTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedInternalTestCase.java @@ -79,7 +79,7 @@ public final class RSSExpandedInternalTestCase extends Assert { assertNotNull(finderPattern); assertEquals(1, finderPattern.getValue()); - try{ + try { rssExpandedReader.retrieveNextPair(row, previousPairs, rowNumber); // the previous was the last pair fail(NotFoundException.class.getName() + " expected"); @@ -116,8 +116,8 @@ public final class RSSExpandedInternalTestCase extends Assert { BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image))); BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null); - int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214) - int value = 0;// A + int[] startEnd = {145, 243}; //image pixels where the A1 pattern starts (at 124) and ends (at 214) + int value = 0; // A FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2); //{1, 8, 4, 1, 1}; RSSExpandedReader rssExpandedReader = new RSSExpandedReader(); @@ -132,7 +132,7 @@ public final class RSSExpandedInternalTestCase extends Assert { BinaryBitmap binaryMap = new BinaryBitmap(new GlobalHistogramBinarizer(new BufferedImageLuminanceSource(image))); BitArray row = binaryMap.getBlackRow(binaryMap.getHeight() / 2, null); - int[] startEnd = {145, 243};//image pixels where the A1 pattern starts (at 124) and ends (at 214) + int[] startEnd = {145, 243}; //image pixels where the A1 pattern starts (at 124) and ends (at 214) int value = 0; // A FinderPattern finderPatternA1 = new FinderPattern(value, startEnd, startEnd[0], startEnd[1], image.getHeight() / 2); //{1, 8, 4, 1, 1}; diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox1TestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox1TestCase.java index f56870b1c..dabe8b13c 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox1TestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox1TestCase.java @@ -30,6 +30,10 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * A test of {@link RSSExpandedReader} against a fixed test set of images including + * stacked RSS barcodes. + */ public final class RSSExpandedStackedBlackBox1TestCase extends AbstractBlackBoxTestCase { public RSSExpandedStackedBlackBox1TestCase() { diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox2TestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox2TestCase.java index 2431eddb7..ee0e008ca 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox2TestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedBlackBox2TestCase.java @@ -30,6 +30,10 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * A test of {@link RSSExpandedReader} against a fixed test set of images including + * stacked RSS barcodes. + */ public final class RSSExpandedStackedBlackBox2TestCase extends AbstractBlackBoxTestCase { public RSSExpandedStackedBlackBox2TestCase() { diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java index cf7c3c056..7b18046ca 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/RSSExpandedStackedInternalTestCase.java @@ -37,6 +37,9 @@ import com.google.zxing.NotFoundException; import com.google.zxing.Result; import com.google.zxing.common.BitArray; +/** + * Tests {@link RSSExpandedReader} handling of stacked RSS barcodes. + */ public final class RSSExpandedStackedInternalTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3103_DecoderTest.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI013103DecoderTest.java similarity index 74% rename from core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3103_DecoderTest.java rename to core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI013103DecoderTest.java index 803ea0d4b..28e3c30ff 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3103_DecoderTest.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI013103DecoderTest.java @@ -32,27 +32,27 @@ import org.junit.Test; /** * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) */ -public final class AI01_3103_DecoderTest extends AbstractDecoderTest { +public final class AI013103DecoderTest extends AbstractDecoderTest { private static final String header = "..X.."; @Test - public void test01_3103_1() throws Exception { - CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750; + public void test0131031() throws Exception { + CharSequence data = header + compressedGtin900123456798908 + compressed15bitWeight1750; String expected = "(01)90012345678908(3103)001750"; assertCorrectBinaryString(data, expected); } @Test - public void test01_3103_2() throws Exception { - CharSequence data = header + compressedGtin_900000000000008 + compressed15bitWeight_0; + public void test0131032() throws Exception { + CharSequence data = header + compressedGtin900000000000008 + compressed15bitWeight0; String expected = "(01)90000000000003(3103)000000"; assertCorrectBinaryString(data, expected); } @Test(expected = NotFoundException.class) - public void test01_3103_invalid() throws Exception { - CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750 + ".."; + public void test013103invalid() throws Exception { + CharSequence data = header + compressedGtin900123456798908 + compressed15bitWeight1750 + ".."; assertCorrectBinaryString(data, ""); } } diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3202_3203_DecoderTest.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI0132023203DecoderTest.java similarity index 79% rename from core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3202_3203_DecoderTest.java rename to core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI0132023203DecoderTest.java index 0db1c8bc8..addf9a94c 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3202_3203_DecoderTest.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI0132023203DecoderTest.java @@ -31,21 +31,21 @@ import org.junit.Test; /** * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) */ -public final class AI01_3202_3203_DecoderTest extends AbstractDecoderTest { +public final class AI0132023203DecoderTest extends AbstractDecoderTest { private static final String header = "..X.X"; @Test - public void test01_3202_1() throws Exception { - CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_1750; + public void test0132021() throws Exception { + CharSequence data = header + compressedGtin900123456798908 + compressed15bitWeight1750; String expected = "(01)90012345678908(3202)001750"; assertCorrectBinaryString(data, expected); } @Test - public void test01_3203_1() throws Exception { - CharSequence data = header + compressedGtin_900123456798908 + compressed15bitWeight_11750; + public void test0132031() throws Exception { + CharSequence data = header + compressedGtin900123456798908 + compressed15bitWeight11750; String expected = "(01)90012345678908(3203)001750"; assertCorrectBinaryString(data, expected); diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3X0X_1X_DecoderTest.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI013X0X1XDecoderTest.java similarity index 50% rename from core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3X0X_1X_DecoderTest.java rename to core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI013X0X1XDecoderTest.java index 2afa39523..f491b595a 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI01_3X0X_1X_DecoderTest.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AI013X0X1XDecoderTest.java @@ -31,84 +31,84 @@ import org.junit.Test; /** * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) */ -public final class AI01_3X0X_1X_DecoderTest extends AbstractDecoderTest { +public final class AI013X0X1XDecoderTest extends AbstractDecoderTest { - private static final String header_310x_11 = "..XXX..."; - private static final String header_320x_11 = "..XXX..X"; - private static final String header_310x_13 = "..XXX.X."; - private static final String header_320x_13 = "..XXX.XX"; - private static final String header_310x_15 = "..XXXX.."; - private static final String header_320x_15 = "..XXXX.X"; - private static final String header_310x_17 = "..XXXXX."; - private static final String header_320x_17 = "..XXXXXX"; + private static final String header310x11 = "..XXX..."; + private static final String header320x11 = "..XXX..X"; + private static final String header310x13 = "..XXX.X."; + private static final String header320x13 = "..XXX.XX"; + private static final String header310x15 = "..XXXX.."; + private static final String header320x15 = "..XXXX.X"; + private static final String header310x17 = "..XXXXX."; + private static final String header320x17 = "..XXXXXX"; @Test - public void test01_310X_1X_endDate() throws Exception { - CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_End; + public void test01310X1XendDate() throws Exception { + CharSequence data = header310x11 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateEnd; String expected = "(01)90012345678908(3100)001750"; assertCorrectBinaryString(data, expected); } @Test - public void test01_310X_11_1() throws Exception { - CharSequence data = header_310x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01310X111() throws Exception { + CharSequence data = header310x11 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3100)001750(11)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_320X_11_1() throws Exception { - CharSequence data = header_320x_11 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01320X111() throws Exception { + CharSequence data = header320x11 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3200)001750(11)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_310X_13_1() throws Exception { - CharSequence data = header_310x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01310X131() throws Exception { + CharSequence data = header310x13 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3100)001750(13)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_320X_13_1() throws Exception { - CharSequence data = header_320x_13 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01320X131() throws Exception { + CharSequence data = header320x13 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3200)001750(13)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_310X_15_1() throws Exception { - CharSequence data = header_310x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01310X151() throws Exception { + CharSequence data = header310x15 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3100)001750(15)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_320X_15_1() throws Exception { - CharSequence data = header_320x_15 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01320X151() throws Exception { + CharSequence data = header320x15 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3200)001750(15)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_310X_17_1() throws Exception { - CharSequence data = header_310x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01310X171() throws Exception { + CharSequence data = header310x17 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3100)001750(17)100312"; assertCorrectBinaryString(data, expected); } @Test - public void test01_320X_17_1() throws Exception { - CharSequence data = header_320x_17 + compressedGtin_900123456798908 + compressed20bitWeight_1750 + compressedDate_March_12th_2010; + public void test01320X171() throws Exception { + CharSequence data = header320x17 + compressedGtin900123456798908 + compressed20bitWeight1750 + compressedDateMarch12th2010; String expected = "(01)90012345678908(3200)001750(17)100312"; assertCorrectBinaryString(data, expected); diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AbstractDecoderTest.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AbstractDecoderTest.java index 0cc69835a..d3f525d31 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AbstractDecoderTest.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AbstractDecoderTest.java @@ -38,34 +38,34 @@ import org.junit.Assert; */ abstract class AbstractDecoderTest extends Assert { - static final String numeric_10 = "..X..XX"; - static final String numeric_12 = "..X.X.X"; - static final String numeric_1FNC1 = "..XXX.X"; - // static final String numeric_FNC11 = "XXX.XXX"; + static final String numeric10 = "..X..XX"; + static final String numeric12 = "..X.X.X"; + static final String numeric1FNC1 = "..XXX.X"; + // static final String numericFNC11 = "XXX.XXX"; static final String numeric2alpha = "...."; - static final String alpha_A = "X....."; - static final String alpha_FNC1 = ".XXXX"; + static final String alphaA = "X....."; + static final String alphaFNC1 = ".XXXX"; static final String alpha2numeric = "..."; static final String alpha2isoiec646 = "..X.."; - static final String i646_B = "X.....X"; - static final String i646_C = "X....X."; - static final String i646_FNC1 = ".XXXX"; - static final String isoiec646_2alpha = "..X.."; + static final String i646B = "X.....X"; + static final String i646C = "X....X."; + static final String i646FNC1 = ".XXXX"; + static final String isoiec6462alpha = "..X.."; - static final String compressedGtin_900123456798908 = ".........X..XXX.X.X.X...XX.XXXXX.XXXX.X."; - static final String compressedGtin_900000000000008 = "........................................"; + static final String compressedGtin900123456798908 = ".........X..XXX.X.X.X...XX.XXXXX.XXXX.X."; + static final String compressedGtin900000000000008 = "........................................"; - static final String compressed15bitWeight_1750 = "....XX.XX.X.XX."; - static final String compressed15bitWeight_11750 = ".X.XX.XXXX..XX."; - static final String compressed15bitWeight_0 = "..............."; + static final String compressed15bitWeight1750 = "....XX.XX.X.XX."; + static final String compressed15bitWeight11750 = ".X.XX.XXXX..XX."; + static final String compressed15bitWeight0 = "..............."; - static final String compressed20bitWeight_1750 = ".........XX.XX.X.XX."; + static final String compressed20bitWeight1750 = ".........XX.XX.X.XX."; - static final String compressedDate_March_12th_2010 = "....XXXX.X..XX.."; - static final String compressedDate_End = "X..X.XX........."; + static final String compressedDateMarch12th2010 = "....XXXX.X..XX.."; + static final String compressedDateEnd = "X..X.XX........."; static void assertCorrectBinaryString(CharSequence binaryString, String expectedNumber) throws NotFoundException, FormatException { diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoderTest.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoderTest.java index bdb1b48a3..1036c692e 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoderTest.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/AnyAIDecoderTest.java @@ -33,51 +33,51 @@ import org.junit.Test; */ public final class AnyAIDecoderTest extends AbstractDecoderTest { - private static final String header = "....."; + private static final String header = "....."; @Test - public void testAnyAIDecoder_1() throws Exception { - CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2numeric + numeric_12; + public void testAnyAIDecoder1() throws Exception { + CharSequence data = header + numeric10 + numeric12 + numeric2alpha + alphaA + alpha2numeric + numeric12; String expected = "(10)12A12"; assertCorrectBinaryString(data, expected); } @Test - public void testAnyAIDecoder_2() throws Exception { - CharSequence data = header + numeric_10 + numeric_12 + numeric2alpha + alpha_A + alpha2isoiec646 + i646_B; + public void testAnyAIDecoder2() throws Exception { + CharSequence data = header + numeric10 + numeric12 + numeric2alpha + alphaA + alpha2isoiec646 + i646B; String expected = "(10)12AB"; assertCorrectBinaryString(data, expected); } @Test - public void testAnyAIDecoder_3() throws Exception { - CharSequence data = header + numeric_10 + numeric2alpha + alpha2isoiec646 + i646_B + i646_C + isoiec646_2alpha + alpha_A + alpha2numeric + numeric_10; + public void testAnyAIDecoder3() throws Exception { + CharSequence data = header + numeric10 + numeric2alpha + alpha2isoiec646 + i646B + i646C + isoiec6462alpha + alphaA + alpha2numeric + numeric10; String expected = "(10)BCA10"; assertCorrectBinaryString(data, expected); } @Test - public void testAnyAIDecoder_numericFNC1_secondDigit() throws Exception { - CharSequence data = header + numeric_10 + numeric_1FNC1; + public void testAnyAIDecodernumericFNC1secondDigit() throws Exception { + CharSequence data = header + numeric10 + numeric1FNC1; String expected = "(10)1"; assertCorrectBinaryString(data, expected); } @Test - public void testAnyAIDecoder_alphaFNC1() throws Exception { - CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + alpha_FNC1; + public void testAnyAIDecoderalphaFNC1() throws Exception { + CharSequence data = header + numeric10 + numeric2alpha + alphaA + alphaFNC1; String expected = "(10)A"; assertCorrectBinaryString(data, expected); } @Test - public void testAnyAIDecoder_646FNC1() throws Exception { - CharSequence data = header + numeric_10 + numeric2alpha + alpha_A + isoiec646_2alpha + i646_B + i646_FNC1; + public void testAnyAIDecoder646FNC1() throws Exception { + CharSequence data = header + numeric10 + numeric2alpha + alphaA + isoiec6462alpha + i646B + i646FNC1; String expected = "(10)AB"; assertCorrectBinaryString(data, expected); diff --git a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/FieldParserTest.java b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/FieldParserTest.java index a636a3049..9a40ceb0c 100644 --- a/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/FieldParserTest.java +++ b/core/src/test/java/com/google/zxing/oned/rss/expanded/decoders/FieldParserTest.java @@ -43,12 +43,12 @@ public final class FieldParserTest extends Assert { } @Test - public void testParseField() throws Exception{ + public void testParseField() throws Exception { checkFields("(15)991231(3103)001750(10)12A"); } @Test - public void testParseField2() throws Exception{ + public void testParseField2() throws Exception { checkFields("(15)991231(15)991231(3103)001750(10)12A"); } } diff --git a/core/src/test/java/com/google/zxing/pdf417/PDF417BlackBox3TestCase.java b/core/src/test/java/com/google/zxing/pdf417/PDF417BlackBox3TestCase.java index cd565029e..192b877b3 100644 --- a/core/src/test/java/com/google/zxing/pdf417/PDF417BlackBox3TestCase.java +++ b/core/src/test/java/com/google/zxing/pdf417/PDF417BlackBox3TestCase.java @@ -20,6 +20,9 @@ import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatReader; import com.google.zxing.common.AbstractBlackBoxTestCase; +/** + * Tests {@link PDF417Reader} against more sample images. + */ public final class PDF417BlackBox3TestCase extends AbstractBlackBoxTestCase { public PDF417BlackBox3TestCase() { diff --git a/core/src/test/java/com/google/zxing/pdf417/PDF417WriterTestCase.java b/core/src/test/java/com/google/zxing/pdf417/PDF417WriterTestCase.java index facd33d42..3d98a32ff 100644 --- a/core/src/test/java/com/google/zxing/pdf417/PDF417WriterTestCase.java +++ b/core/src/test/java/com/google/zxing/pdf417/PDF417WriterTestCase.java @@ -26,6 +26,9 @@ import com.google.zxing.common.BitMatrix; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link PDF417Writer}. + */ public final class PDF417WriterTestCase extends Assert { @Test diff --git a/core/src/test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java b/core/src/test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java index 334def2d3..cb70c0a9a 100644 --- a/core/src/test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java +++ b/core/src/test/java/com/google/zxing/pdf417/decoder/PDF417DecoderTestCase.java @@ -21,6 +21,9 @@ import com.google.zxing.pdf417.PDF417ResultMetadata; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link DecodedBitStreamParser}. + */ public class PDF417DecoderTestCase extends Assert { /** 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 315132fcc..4d4b35b2a 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 @@ -21,6 +21,9 @@ import java.nio.charset.StandardCharsets; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link PDF417HighLevelEncoder}. + */ public final class PDF417EncoderTestCase extends Assert { @Test @@ -32,15 +35,15 @@ public final class PDF417EncoderTestCase extends Assert { @Test public void testEncodeAutoWithSpecialChars() throws Exception { - //Just check if this does not throw an exception + // Just check if this does not throw an exception PDF417HighLevelEncoder.encodeHighLevel( "1%§s ?aG$", Compaction.AUTO, StandardCharsets.UTF_8); } @Test public void testEncodeIso88591WithSpecialChars() throws Exception { - // Just check if this does not throw an exception - PDF417HighLevelEncoder.encodeHighLevel("asdfg§asd", Compaction.AUTO, StandardCharsets.ISO_8859_1); + // Just check if this does not throw an exception + PDF417HighLevelEncoder.encodeHighLevel("asdfg§asd", Compaction.AUTO, StandardCharsets.ISO_8859_1); } @Test diff --git a/core/src/test/java/com/google/zxing/qrcode/decoder/VersionTestCase.java b/core/src/test/java/com/google/zxing/qrcode/decoder/VersionTestCase.java index 3d3227cb2..7eaec0a57 100644 --- a/core/src/test/java/com/google/zxing/qrcode/decoder/VersionTestCase.java +++ b/core/src/test/java/com/google/zxing/qrcode/decoder/VersionTestCase.java @@ -33,7 +33,7 @@ public final class VersionTestCase extends Assert { // good } for (int i = 1; i <= 40; i++) { - checkVersion(Version.getVersionForNumber(i), i, 4*i + 17); + checkVersion(Version.getVersionForNumber(i), i, 4 * i + 17); } } @@ -55,7 +55,7 @@ public final class VersionTestCase extends Assert { @Test public void testGetProvisionalVersionForDimension() throws Exception { for (int i = 1; i <= 40; i++) { - assertEquals(i, Version.getProvisionalVersionForDimension(4*i + 17).getVersionNumber()); + assertEquals(i, Version.getProvisionalVersionForDimension(4 * i + 17).getVersionNumber()); } } 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 d5bc6de59..ebf00e261 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 @@ -84,13 +84,13 @@ public final class EncoderTestCase extends Assert { // AIUE in Hiragana in Shift_JIS assertSame(Mode.BYTE, - Encoder.chooseMode(shiftJISString(new byte[]{0x8, 0xa, 0x8, 0xa, 0x8, 0xa, 0x8, (byte) 0xa6}))); + Encoder.chooseMode(shiftJISString(bytes(0x8, 0xa, 0x8, 0xa, 0x8, 0xa, 0x8, 0xa6)))); // Nihon in Kanji in Shift_JIS. - assertSame(Mode.BYTE, Encoder.chooseMode(shiftJISString(new byte[]{0x9, 0xf, 0x9, 0x7b}))); + assertSame(Mode.BYTE, Encoder.chooseMode(shiftJISString(bytes(0x9, 0xf, 0x9, 0x7b)))); // Sou-Utsu-Byou in Kanji in Shift_JIS. - assertSame(Mode.BYTE, Encoder.chooseMode(shiftJISString(new byte[]{0xe, 0x4, 0x9, 0x5, 0x9, 0x61}))); + assertSame(Mode.BYTE, Encoder.chooseMode(shiftJISString(bytes(0xe, 0x4, 0x9, 0x5, 0x9, 0x61)))); } @Test @@ -388,7 +388,8 @@ public final class EncoderTestCase extends Assert { // Should use appendKanjiBytes. // 0x93, 0x5f bits = new BitArray(); - Encoder.appendBytes(shiftJISString(new byte[] {(byte)0x93,0x5f}), Mode.KANJI, bits, Encoder.DEFAULT_BYTE_MODE_ENCODING); + Encoder.appendBytes(shiftJISString(bytes(0x93, 0x5f)), Mode.KANJI, bits, + Encoder.DEFAULT_BYTE_MODE_ENCODING); assertEquals(" .XX.XX.. XXXXX", bits.toString()); } @@ -460,19 +461,19 @@ public final class EncoderTestCase extends Assert { @Test public void testInterleaveWithECBytes() throws WriterException { - byte[] dataBytes = {32, 65, (byte)205, 69, 41, (byte)220, 46, (byte)128, (byte)236}; + byte[] dataBytes = bytes(32, 65, 205, 69, 41, 220, 46, 128, 236); BitArray in = new BitArray(); for (byte dataByte: dataBytes) { in.appendBits(dataByte, 8); } BitArray out = Encoder.interleaveWithECBytes(in, 26, 9, 1); - byte[] expected = { + byte[] expected = bytes( // Data bytes. - 32, 65, (byte)205, 69, 41, (byte)220, 46, (byte)128, (byte)236, + 32, 65, 205, 69, 41, 220, 46, 128, 236, // Error correction bytes. - 42, (byte)159, 74, (byte)221, (byte)244, (byte)169, (byte)239, (byte)150, (byte)138, 70, - (byte)237, 85, (byte)224, 96, 74, (byte)219, 61, - }; + 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, + 237, 85, 224, 96, 74, 219, 61 + ); assertEquals(expected.length, out.getSizeInBytes()); byte[] outArray = new byte[expected.length]; out.toBytes(0, outArray, 0, expected.length); @@ -481,37 +482,37 @@ public final class EncoderTestCase extends Assert { assertEquals(expected[x], outArray[x]); } // Numbers are from http://www.swetake.com/qr/qr8.html - dataBytes = new byte[] { - 67, 70, 22, 38, 54, 70, 86, 102, 118, (byte)134, (byte)150, (byte)166, (byte)182, - (byte)198, (byte)214, (byte)230, (byte)247, 7, 23, 39, 55, 71, 87, 103, 119, (byte)135, - (byte)151, (byte)166, 22, 38, 54, 70, 86, 102, 118, (byte)134, (byte)150, (byte)166, - (byte)182, (byte)198, (byte)214, (byte)230, (byte)247, 7, 23, 39, 55, 71, 87, 103, 119, - (byte)135, (byte)151, (byte)160, (byte)236, 17, (byte)236, 17, (byte)236, 17, (byte)236, + dataBytes = bytes( + 67, 70, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, + 198, 214, 230, 247, 7, 23, 39, 55, 71, 87, 103, 119, 135, + 151, 166, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, + 182, 198, 214, 230, 247, 7, 23, 39, 55, 71, 87, 103, 119, + 135, 151, 160, 236, 17, 236, 17, 236, 17, 236, 17 - }; + ); in = new BitArray(); for (byte dataByte: dataBytes) { in.appendBits(dataByte, 8); } out = Encoder.interleaveWithECBytes(in, 134, 62, 4); - expected = new byte[] { + expected = bytes( // Data bytes. - 67, (byte)230, 54, 55, 70, (byte)247, 70, 71, 22, 7, 86, 87, 38, 23, 102, 103, 54, 39, - 118, 119, 70, 55, (byte)134, (byte)135, 86, 71, (byte)150, (byte)151, 102, 87, (byte)166, - (byte)160, 118, 103, (byte)182, (byte)236, (byte)134, 119, (byte)198, 17, (byte)150, - (byte)135, (byte)214, (byte)236, (byte)166, (byte)151, (byte)230, 17, (byte)182, - (byte)166, (byte)247, (byte)236, (byte)198, 22, 7, 17, (byte)214, 38, 23, (byte)236, 39, + 67, 230, 54, 55, 70, 247, 70, 71, 22, 7, 86, 87, 38, 23, 102, 103, 54, 39, + 118, 119, 70, 55, 134, 135, 86, 71, 150, 151, 102, 87, 166, + 160, 118, 103, 182, 236, 134, 119, 198, 17, 150, + 135, 214, 236, 166, 151, 230, 17, 182, + 166, 247, 236, 198, 22, 7, 17, 214, 38, 23, 236, 39, 17, // Error correction bytes. - (byte)175, (byte)155, (byte)245, (byte)236, 80, (byte)146, 56, 74, (byte)155, (byte)165, - (byte)133, (byte)142, 64, (byte)183, (byte)132, 13, (byte)178, 54, (byte)132, 108, 45, - 113, 53, 50, (byte)214, 98, (byte)193, (byte)152, (byte)233, (byte)147, 50, 71, 65, - (byte)190, 82, 51, (byte)209, (byte)199, (byte)171, 54, 12, 112, 57, 113, (byte)155, 117, - (byte)211, (byte)164, 117, 30, (byte)158, (byte)225, 31, (byte)190, (byte)242, 38, - (byte)140, 61, (byte)179, (byte)154, (byte)214, (byte)138, (byte)147, 87, 27, 96, 77, 47, - (byte)187, 49, (byte)156, (byte)214, - }; + 175, 155, 245, 236, 80, 146, 56, 74, 155, 165, + 133, 142, 64, 183, 132, 13, 178, 54, 132, 108, 45, + 113, 53, 50, 214, 98, 193, 152, 233, 147, 50, 71, 65, + 190, 82, 51, 209, 199, 171, 54, 12, 112, 57, 113, 155, 117, + 211, 164, 117, 30, 158, 225, 31, 190, 242, 38, + 140, 61, 179, 154, 214, 138, 147, 87, 27, 96, 77, 47, + 187, 49, 156, 214 + ); assertEquals(expected.length, out.getSizeInBytes()); outArray = new byte[expected.length]; out.toBytes(0, outArray, 0, expected.length); @@ -520,6 +521,14 @@ public final class EncoderTestCase extends Assert { } } + private static byte[] bytes(int... ints) { + byte[] bytes = new byte[ints.length]; + for (int i = 0; i < ints.length; i++) { + bytes[i] = (byte) ints[i]; + } + return bytes; + } + @Test public void testAppendNumericBytes() { // 1 = 01 = 0001 in 4 bits. @@ -586,9 +595,9 @@ public final class EncoderTestCase extends Assert { @Test public void testAppendKanjiBytes() throws WriterException { BitArray bits = new BitArray(); - Encoder.appendKanjiBytes(shiftJISString(new byte[] {(byte)0x93,0x5f}), bits); + Encoder.appendKanjiBytes(shiftJISString(bytes(0x93, 0x5f)), bits); assertEquals(" .XX.XX.. XXXXX", bits.toString()); - Encoder.appendKanjiBytes(shiftJISString(new byte[] {(byte)0xe4,(byte)0xaa}), bits); + Encoder.appendKanjiBytes(shiftJISString(bytes(0xe4, 0xaa)), bits); assertEquals(" .XX.XX.. XXXXXXX. X.X.X.X. X.", bits.toString()); } @@ -596,7 +605,7 @@ public final class EncoderTestCase extends Assert { // http://www.swetake.com/qr/qr9.html @Test public void testGenerateECBytes() { - byte[] dataBytes = {32, 65, (byte)205, 69, 41, (byte)220, 46, (byte)128, (byte)236}; + byte[] dataBytes = bytes(32, 65, 205, 69, 41, 220, 46, 128, 236); byte[] ecBytes = Encoder.generateECBytes(dataBytes, 17); int[] expected = { 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61 @@ -605,8 +614,7 @@ public final class EncoderTestCase extends Assert { for (int x = 0; x < expected.length; x++) { assertEquals(expected[x], ecBytes[x] & 0xFF); } - dataBytes = new byte[] {67, 70, 22, 38, 54, 70, 86, 102, 118, - (byte)134, (byte)150, (byte)166, (byte)182, (byte)198, (byte)214}; + dataBytes = bytes(67, 70, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214); ecBytes = Encoder.generateECBytes(dataBytes, 18); expected = new int[] { 175, 80, 155, 64, 178, 45, 214, 233, 65, 209, 12, 155, 117, 31, 140, 214, 27, 187 @@ -616,7 +624,7 @@ public final class EncoderTestCase extends Assert { assertEquals(expected[x], ecBytes[x] & 0xFF); } // High-order zero coefficient case. - dataBytes = new byte[] {32, 49, (byte)205, 69, 42, 20, 0, (byte)236, 17}; + dataBytes = bytes(32, 49, 205, 69, 42, 20, 0, 236, 17); ecBytes = Encoder.generateECBytes(dataBytes, 17); expected = new int[] { 0, 3, 130, 179, 194, 0, 55, 211, 110, 79, 98, 72, 170, 96, 211, 137, 213 @@ -664,7 +672,7 @@ public final class EncoderTestCase extends Assert { Encoder.encode(builder.toString(), ErrorCorrectionLevel.L); } - private void verifyGS1EncodedData(QRCode qrCode) { + private static void verifyGS1EncodedData(QRCode qrCode) { String expected = "<<\n" + " mode: ALPHANUMERIC\n" + @@ -701,7 +709,7 @@ public final class EncoderTestCase extends Assert { assertEquals(expected, qrCode.toString()); } - private void verifyNotGS1EncodedData(QRCode qrCode) { + private static void verifyNotGS1EncodedData(QRCode qrCode) { String expected = "<<\n" + " mode: ALPHANUMERIC\n" + diff --git a/core/src/test/java/com/google/zxing/qrcode/encoder/MaskUtilTestCase.java b/core/src/test/java/com/google/zxing/qrcode/encoder/MaskUtilTestCase.java index 56f1f3d0f..85a0fd0cb 100644 --- a/core/src/test/java/com/google/zxing/qrcode/encoder/MaskUtilTestCase.java +++ b/core/src/test/java/com/google/zxing/qrcode/encoder/MaskUtilTestCase.java @@ -170,7 +170,7 @@ public final class MaskUtilTestCase extends Assert { assertEquals(30, MaskUtil.applyMaskPenaltyRule4(matrix)); } - private static boolean TestGetDataMaskBitInternal(int maskPattern, int[][] expected) { + private static boolean testGetDataMaskBitInternal(int maskPattern, int[][] expected) { for (int x = 0; x < 6; ++x) { for (int y = 0; y < 6; ++y) { if ((expected[y][x] == 1) != MaskUtil.getDataMaskBit(maskPattern, x, y)) { @@ -192,7 +192,7 @@ public final class MaskUtilTestCase extends Assert { {1, 0, 1, 0, 1, 0}, {0, 1, 0, 1, 0, 1}, }; - assertTrue(TestGetDataMaskBitInternal(0, mask0)); + assertTrue(testGetDataMaskBitInternal(0, mask0)); int[][] mask1 = { {1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 0, 0}, @@ -201,7 +201,7 @@ public final class MaskUtilTestCase extends Assert { {1, 1, 1, 1, 1, 1}, {0, 0, 0, 0, 0, 0}, }; - assertTrue(TestGetDataMaskBitInternal(1, mask1)); + assertTrue(testGetDataMaskBitInternal(1, mask1)); int[][] mask2 = { {1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0}, @@ -210,7 +210,7 @@ public final class MaskUtilTestCase extends Assert { {1, 0, 0, 1, 0, 0}, {1, 0, 0, 1, 0, 0}, }; - assertTrue(TestGetDataMaskBitInternal(2, mask2)); + assertTrue(testGetDataMaskBitInternal(2, mask2)); int[][] mask3 = { {1, 0, 0, 1, 0, 0}, {0, 0, 1, 0, 0, 1}, @@ -219,7 +219,7 @@ public final class MaskUtilTestCase extends Assert { {0, 0, 1, 0, 0, 1}, {0, 1, 0, 0, 1, 0}, }; - assertTrue(TestGetDataMaskBitInternal(3, mask3)); + assertTrue(testGetDataMaskBitInternal(3, mask3)); int[][] mask4 = { {1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0}, @@ -228,7 +228,7 @@ public final class MaskUtilTestCase extends Assert { {1, 1, 1, 0, 0, 0}, {1, 1, 1, 0, 0, 0}, }; - assertTrue(TestGetDataMaskBitInternal(4, mask4)); + assertTrue(testGetDataMaskBitInternal(4, mask4)); int[][] mask5 = { {1, 1, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0}, @@ -237,7 +237,7 @@ public final class MaskUtilTestCase extends Assert { {1, 0, 0, 1, 0, 0}, {1, 0, 0, 0, 0, 0}, }; - assertTrue(TestGetDataMaskBitInternal(5, mask5)); + assertTrue(testGetDataMaskBitInternal(5, mask5)); int[][] mask6 = { {1, 1, 1, 1, 1, 1}, {1, 1, 1, 0, 0, 0}, @@ -246,7 +246,7 @@ public final class MaskUtilTestCase extends Assert { {1, 0, 1, 1, 0, 1}, {1, 0, 0, 0, 1, 1}, }; - assertTrue(TestGetDataMaskBitInternal(6, mask6)); + assertTrue(testGetDataMaskBitInternal(6, mask6)); int[][] mask7 = { {1, 0, 1, 0, 1, 0}, {0, 0, 0, 1, 1, 1}, @@ -255,6 +255,6 @@ public final class MaskUtilTestCase extends Assert { {1, 1, 1, 0, 0, 0}, {0, 1, 1, 1, 0, 0}, }; - assertTrue(TestGetDataMaskBitInternal(7, mask7)); + assertTrue(testGetDataMaskBitInternal(7, mask7)); } } diff --git a/javase/src/main/java/com/google/zxing/client/j2se/DecoderConfig.java b/javase/src/main/java/com/google/zxing/client/j2se/DecoderConfig.java index 9da54eecd..93caf817e 100644 --- a/javase/src/main/java/com/google/zxing/client/j2se/DecoderConfig.java +++ b/javase/src/main/java/com/google/zxing/client/j2se/DecoderConfig.java @@ -84,8 +84,7 @@ final class DecoderConfig { Map buildHints() { List finalPossibleFormats = possibleFormats; if (finalPossibleFormats == null || finalPossibleFormats.isEmpty()) { - finalPossibleFormats = new ArrayList<>(); - finalPossibleFormats.addAll(Arrays.asList( + finalPossibleFormats = new ArrayList<>(Arrays.asList( BarcodeFormat.UPC_A, BarcodeFormat.UPC_E, BarcodeFormat.EAN_13, diff --git a/javase/src/test/java/com/google/zxing/client/j2se/Base64DecoderTestCase.java b/javase/src/test/java/com/google/zxing/client/j2se/Base64DecoderTestCase.java index 8b286fbb9..86bdacf37 100644 --- a/javase/src/test/java/com/google/zxing/client/j2se/Base64DecoderTestCase.java +++ b/javase/src/test/java/com/google/zxing/client/j2se/Base64DecoderTestCase.java @@ -21,6 +21,9 @@ import org.junit.Test; import java.nio.charset.StandardCharsets; +/** + * Tests {@link Base64Decoder}. + */ public final class Base64DecoderTestCase extends Assert { @Test diff --git a/javase/src/test/java/com/google/zxing/client/j2se/ImageReaderTestCase.java b/javase/src/test/java/com/google/zxing/client/j2se/ImageReaderTestCase.java index 029e170db..f8f3fe359 100644 --- a/javase/src/test/java/com/google/zxing/client/j2se/ImageReaderTestCase.java +++ b/javase/src/test/java/com/google/zxing/client/j2se/ImageReaderTestCase.java @@ -22,6 +22,9 @@ import org.junit.Test; import java.awt.image.BufferedImage; import java.net.URI; +/** + * Tests {@link ImageReader}. + */ public final class ImageReaderTestCase extends Assert { @Test diff --git a/javase/src/test/java/com/google/zxing/client/j2se/MatrixToImageWriterTestCase.java b/javase/src/test/java/com/google/zxing/client/j2se/MatrixToImageWriterTestCase.java index 292acbeef..898a06afc 100644 --- a/javase/src/test/java/com/google/zxing/client/j2se/MatrixToImageWriterTestCase.java +++ b/javase/src/test/java/com/google/zxing/client/j2se/MatrixToImageWriterTestCase.java @@ -26,6 +26,9 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +/** + * Tests {@link MatrixToImageWriter}. + */ public final class MatrixToImageWriterTestCase extends Assert { @Test diff --git a/pom.xml b/pom.xml index dd1d1b6f4..abdee1163 100644 --- a/pom.xml +++ b/pom.xml @@ -82,7 +82,7 @@ UTF-8 UTF-8 1.7 - 6.0.2 + 6.0.3 2.0.14 1.7.25 @@ -451,6 +451,7 @@ src/checkstyle/checkstyle.xml **/R.java,**/BuildConfig.java,**/Manifest.java + true @@ -465,7 +466,7 @@ com.puppycrawl.tools checkstyle - 8.9 + 8.10 diff --git a/zxingorg/src/main/java/com/google/zxing/web/AbstractFilter.java b/zxingorg/src/main/java/com/google/zxing/web/AbstractFilter.java index 7cc30978f..d8af61520 100644 --- a/zxingorg/src/main/java/com/google/zxing/web/AbstractFilter.java +++ b/zxingorg/src/main/java/com/google/zxing/web/AbstractFilter.java @@ -33,7 +33,7 @@ import java.io.IOException; abstract class AbstractFilter implements Filter { @Override - public void init(FilterConfig filterConfig) throws ServletException { + public final void init(FilterConfig filterConfig) { // do nothing } @@ -41,8 +41,9 @@ abstract class AbstractFilter implements Filter { public abstract void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException; + @Override - public void destroy() { + public final void destroy() { // do nothing } diff --git a/zxingorg/src/main/java/com/google/zxing/web/OutputUtils.java b/zxingorg/src/main/java/com/google/zxing/web/OutputUtils.java index 74ccb4f27..7d31fc87c 100644 --- a/zxingorg/src/main/java/com/google/zxing/web/OutputUtils.java +++ b/zxingorg/src/main/java/com/google/zxing/web/OutputUtils.java @@ -50,7 +50,7 @@ public final class OutputUtils { private static char hexChar(int value) { if (value < 0 || value > 15) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException("Bad hex digit value " + value); } return (char) (value < 10 ? ('0' + value) : ('a' + (value - 10))); } diff --git a/zxingorg/src/main/java/com/google/zxing/web/WelcomeFilter.java b/zxingorg/src/main/java/com/google/zxing/web/WelcomeFilter.java index 216cb938f..411d9f29f 100644 --- a/zxingorg/src/main/java/com/google/zxing/web/WelcomeFilter.java +++ b/zxingorg/src/main/java/com/google/zxing/web/WelcomeFilter.java @@ -17,11 +17,9 @@ package com.google.zxing.web; import javax.servlet.FilterChain; -import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.annotation.WebFilter; -import java.io.IOException; /** * Handles redirects to the app landing page. @@ -32,7 +30,7 @@ public final class WelcomeFilter extends AbstractFilter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, - FilterChain filterChain) throws IOException, ServletException { + FilterChain filterChain) { redirect(servletResponse, "/w/decode.jspx"); } diff --git a/zxingorg/src/test/java/com/google/zxing/web/OutputUtilsTestCase.java b/zxingorg/src/test/java/com/google/zxing/web/OutputUtilsTestCase.java index ade772d74..d5cfc4cfa 100644 --- a/zxingorg/src/test/java/com/google/zxing/web/OutputUtilsTestCase.java +++ b/zxingorg/src/test/java/com/google/zxing/web/OutputUtilsTestCase.java @@ -19,11 +19,14 @@ package com.google.zxing.web; import org.junit.Assert; import org.junit.Test; +/** + * Tests {@link OutputUtils}. + */ public final class OutputUtilsTestCase extends Assert { @Test public void testOutput() { - byte[] array = new byte[] { 0, 1, -1, 127, -128, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; + byte[] array = { 0, 1, -1, 127, -128, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; assertEquals( "00 01 ff 7f 80 02 03 04 05 06 07 08 09 0a 0b 0c\n", OutputUtils.arrayToString(array));