@Test public void testUnpackThrowsArrayIndexOutOfBoundsException() throws Throwable { byte[] bytes = new byte[2]; InputStream in = new ByteArrayInputStream(bytes); try { new IFEB_LLLNUM().unpack(new ISOMsg("testISOFieldPackagerMti"), in); fail("Expected ArrayIndexOutOfBoundsException to be thrown"); } catch (ArrayIndexOutOfBoundsException ex) { if (isJavaVersionAtMost(JAVA_10)) { assertEquals("2", ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Index 2 out of bounds for length 2", ex.getMessage(), "ex.getMessage()"); } assertEquals(0, in.available(), "(ByteArrayInputStream) in.available()"); } }
public abstract int unpack (ISOComponent c, byte[] b, int offset) throws ISOException;
ISOFieldPackager { public abstract int unpack (ISOComponent c, byte[] b, int offset) throws ISOException; }
ISOFieldPackager { public abstract int unpack (ISOComponent c, byte[] b, int offset) throws ISOException; ISOFieldPackager();  ISOFieldPackager(int len, String description); }
ISOFieldPackager { public abstract int unpack (ISOComponent c, byte[] b, int offset) throws ISOException; ISOFieldPackager();  ISOFieldPackager(int len, String description); String getDescription(); void setDescription(String description); int getLength(); void setLength(int len); void setPad(boolean pad); void setTrim(boolean trim); abstract int getMaxPackedLength(); ISOComponent createComponent(int fieldNumber); abstract byte[] pack(ISOComponent c); abstract int unpack(ISOComponent c, byte[] b, int offset); void unpack(ISOComponent c, InputStream in); void pack(ISOComponent c, ObjectOutput out); }
ISOFieldPackager { public abstract int unpack (ISOComponent c, byte[] b, int offset) throws ISOException; ISOFieldPackager();  ISOFieldPackager(int len, String description); String getDescription(); void setDescription(String description); int getLength(); void setLength(int len); void setPad(boolean pad); void setTrim(boolean trim); abstract int getMaxPackedLength(); ISOComponent createComponent(int fieldNumber); abstract byte[] pack(ISOComponent c); abstract int unpack(ISOComponent c, byte[] b, int offset); void unpack(ISOComponent c, InputStream in); void pack(ISOComponent c, ObjectOutput out);  }