@Test public void testGetPackedLength() throws Throwable { int result = new EbcdicPrefixer(100).getPackedLength(); assertEquals("result", 100, result); }
@Test public void testDecodeLength() throws Throwable { byte[] b = new byte[1]; int result = new EbcdicPrefixer(0).decodeLength(b, 100); assertEquals("result", 0, result); }
@Test public void testEncodeLength() throws Throwable { byte[] b = new byte[4]; new EbcdicPrefixer(1).encodeLength(100, b); assertEquals("b[0]", (byte) -16, b[0]); }
public void testReversability() throws Exception { int len = 3; byte[] b = new byte[2]; EbcdicPrefixer.LL.encodeLength(len, b); assertEquals(len, EbcdicPrefixer.LL.decodeLength(b, 0)); } }
public IFEP_LLLBINARY(int length, String description) { super(length, description, LiteralBinaryInterpreter.INSTANCE, EbcdicPrefixer.LLL); checkLength(length, 999); prefixerPackedLength = EbcdicPrefixer.LLL.getPackedLength(); }
public void testEncode() throws Exception { byte[] b = new byte[2]; EbcdicPrefixer.LL.encodeLength(21, b); TestUtils.assertEquals(new byte[]{(byte)0xF2, (byte)0xF1}, b); }
public void testDecode() throws Exception { byte[] b = new byte[]{(byte)0xF2, (byte)0xF5}; assertEquals(25, EbcdicPrefixer.LL.decodeLength(b, 0)); }
@Test public void testEncodeLength2() throws Throwable { byte[] bytes = new byte[2]; EbcdicPrefixer.LL.encodeLength(100, bytes); assertEquals("bytes[0]", (byte) -16, bytes[0]); }
@Test public void testDecodeLength1() throws Throwable { byte[] bytes = new byte[2]; bytes[0] = (byte) -14; int result = EbcdicPrefixer.LL.decodeLength(bytes, 0); assertEquals("result", 20, result); }
@Test public void testConstructor() throws Throwable { EbcdicPrefixer ebcdicPrefixer = new EbcdicPrefixer(100); assertEquals("ebcdicPrefixer.getPackedLength()", 100, ebcdicPrefixer.getPackedLength()); }
@Test public void testEncodeLength1() throws Throwable { byte[] b = new byte[0]; new EbcdicPrefixer(0).encodeLength(100, b); assertEquals("b.length", 0, b.length); }
@Test public void testDecodeLengthThrowsNullPointerException() throws Throwable { try { new EbcdicPrefixer(100).decodeLength(null, 100); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@Test public void testGetPackedLength1() throws Throwable { int result = new EbcdicPrefixer(0).getPackedLength(); assertEquals("result", 0, result); } }
@Test public void testEncodeLengthThrowsNullPointerException() throws Throwable { try { new EbcdicPrefixer(2).encodeLength(100, null); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@Test public void testDecodeLengthThrowsArrayIndexOutOfBoundsException() throws Throwable { byte[] b = new byte[0]; try { new EbcdicPrefixer(100).decodeLength(b, 100); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "100", ex.getMessage()); } }
@Test public void testEncodeLengthThrowsArrayIndexOutOfBoundsException1() throws Throwable { byte[] b = new byte[1]; try { new EbcdicPrefixer(2).encodeLength(100, b); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "1", ex.getMessage()); assertEquals("b.length", 1, b.length); } }
@Test public void testDecodeLengthThrowsArrayIndexOutOfBoundsException1() throws Throwable { byte[] b = new byte[50]; try { new EbcdicPrefixer(100).decodeLength(b, 0); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "50", ex.getMessage()); } }
@Test public void testEncodeLengthThrowsArrayIndexOutOfBoundsException() throws Throwable { byte[] b = new byte[2]; try { new EbcdicPrefixer(2).encodeLength(-10, b); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { assertEquals("b[1]", (byte) -16, b[1]); assertEquals("ex.getMessage()", "-1", ex.getMessage()); assertEquals("b.length", 2, b.length); } }