public void testInterpretPositive() throws Exception { byte[] expectedRawData = new byte[] { (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0xf1, (byte) 0xf3, (byte) 0xf5, (byte) 0xf7, (byte) 0xf8, (byte) 0xf6, (byte) 0x12, (byte) 0x9a }; byte[] rawData = new byte[] { (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x12, (byte) 0x9a }; int offset = 3; String string = "135786"; signedEbcdicNumberInterpreter.interpret(string, rawData, offset); assertTrue("Expected " + ISOUtil.hexdump(expectedRawData) + " but was " + ISOUtil.hexdump(rawData), Arrays.equals(expectedRawData, rawData)); } }
@Test public void testHexdump() throws Throwable { byte[] b = new byte[34]; b[16] = (byte) 127; String result = ISOUtil.hexdump(b, 0, 17); assertEquals("result", "0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + lineSep + "0010 7F ." + lineSep, result); }
@Test public void testHexdump6() throws Throwable { byte[] b = new byte[34]; String result = ISOUtil.hexdump(b, 0, 10); assertEquals("result", "0000 00 00 00 00 00 00 00 00 00 00 .........." + lineSep, result); }
@Test public void testHexdump17() throws Throwable { byte[] b = new byte[3]; b[1] = (byte) 31; String result = ISOUtil.hexdump(b, 0, 3); assertEquals("result", "0000 00 1F 00 ..." + lineSep, result); }
@Test public void testHexdump4() throws Throwable { byte[] b = new byte[3]; b[1] = (byte) -4; String result = ISOUtil.hexdump(b, 1, 1); assertEquals("result", "0000 FC ." + lineSep, result); }
@Test public void testHexdump1() throws Throwable { byte[] b = new byte[34]; b[17] = (byte) 31; String result = ISOUtil.hexdump(b, 0, 32); assertEquals("result", "0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + lineSep + "0010 00 1F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + lineSep, result); }
@Test public void testHexdump11() throws Throwable { byte[] b = new byte[3]; b[1] = (byte) 127; String result = ISOUtil.hexdump(b); assertEquals("result", "0000 00 7F 00 ..." + lineSep, result); }
@Test public void testHexdump14() throws Throwable { byte[] b = new byte[2]; b[0] = (byte) 126; String result = ISOUtil.hexdump(b); assertEquals("result", "0000 7E 00 ~." + lineSep, result); }
@Test public void testHexdump21() throws Throwable { byte[] b = new byte[19]; b[0] = (byte) 127; b[1] = (byte) 32; String result = ISOUtil.hexdump(b, 0, 3); assertEquals("result", "0000 7F 20 00 . ." + lineSep, result); }
@Test public void testHexdump23() throws Throwable { byte[] b = new byte[12]; b[6] = (byte) -48; String result = ISOUtil.hexdump(b, 0, 10); assertEquals("result", "0000 00 00 00 00 00 00 D0 00 00 00 .........." + lineSep, result); }
@Test public void testHexdump7() throws Throwable { byte[] b = new byte[10]; b[7] = (byte) -2; String result = ISOUtil.hexdump(b, 7, 1); assertEquals("result", "0000 FE ." + lineSep, result); }
@Test public void testHexdump9() throws Throwable { byte[] b = new byte[34]; b[16] = (byte) 127; String result = ISOUtil.hexdump(b, 0, 32); assertEquals("result", "0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + lineSep + "0010 7F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + lineSep, result); }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException5() throws Throwable { byte[] b = new byte[18]; b[14] = (byte) 46; try { ISOUtil.hexdump(b, 10, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "18", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException7() throws Throwable { byte[] b = new byte[3]; b[1] = (byte) 31; b[2] = (byte) -48; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "3", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException1() throws Throwable { byte[] b = new byte[34]; b[16] = (byte) 127; b[17] = (byte) 31; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "34", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException10() throws Throwable { byte[] b = new byte[2]; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "2", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException12() throws Throwable { byte[] b = new byte[10]; b[7] = (byte) -2; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "10", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException8() throws Throwable { byte[] b = new byte[1]; b[0] = (byte) 32; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "1", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException11() throws Throwable { byte[] b = new byte[1]; b[0] = (byte) -49; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "1", ex.getMessage()); } }
@Test public void testHexdumpThrowsArrayIndexOutOfBoundsException() throws Throwable { byte[] b = new byte[19]; b[0] = (byte) 127; b[1] = (byte) 32; b[5] = (byte) 31; try { ISOUtil.hexdump(b, 0, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "19", ex.getMessage()); } }