public void testUnpack() throws Exception { byte[] raw = new byte[] {0x00, 0x0A, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A}; IFB_LLLHCHAR packager = new IFB_LLLHCHAR(10, "Should be ABCDEFGHIJ"); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("ABCDEFGHIJ", (String) field.getValue()); }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(12, origin); IFB_LLLHCHAR packager = new IFB_LLLHCHAR(10, "Should be Abc123:.-"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }