@Test public void testBorderCompact4Case() { String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; String alphabet4 = alphabet + alphabet + alphabet + alphabet; byte[] data = alphabet4.getBytes(StandardCharsets.ISO_8859_1); try { Encoder.encode(data, 0, -4); fail("Encode should have failed. Text can't fit in 1-layer compact"); } catch (IllegalArgumentException expected) { } AztecCode aztecCode = Encoder.encode(data, 0, Encoder.DEFAULT_AZTEC_LAYERS); assertFalse(aztecCode.isCompact()); assertEquals(4, aztecCode.getLayers()); aztecCode = Encoder.encode(alphabet4.substring(0, 100).getBytes(StandardCharsets.ISO_8859_1), 10, Encoder.DEFAULT_AZTEC_LAYERS); assertTrue(aztecCode.isCompact()); assertEquals(4, aztecCode.getLayers()); }
public static AztecCode encode(byte[] data) { return encode(data, DEFAULT_EC_PERCENT, DEFAULT_AZTEC_LAYERS); }
Encoder { public static AztecCode encode(byte[] data) { return encode(data, DEFAULT_EC_PERCENT, DEFAULT_AZTEC_LAYERS); } }
Encoder { public static AztecCode encode(byte[] data) { return encode(data, DEFAULT_EC_PERCENT, DEFAULT_AZTEC_LAYERS); } private  Encoder(); }
Encoder { public static AztecCode encode(byte[] data) { return encode(data, DEFAULT_EC_PERCENT, DEFAULT_AZTEC_LAYERS); } private  Encoder(); static AztecCode encode(byte[] data); static AztecCode encode(byte[] data, int minECCPercent, int userSpecifiedLayers); }
Encoder { public static AztecCode encode(byte[] data) { return encode(data, DEFAULT_EC_PERCENT, DEFAULT_AZTEC_LAYERS); } private  Encoder(); static AztecCode encode(byte[] data); static AztecCode encode(byte[] data, int minECCPercent, int userSpecifiedLayers); static final int DEFAULT_EC_PERCENT; static final int DEFAULT_AZTEC_LAYERS; }