protected void unpackTag(ISOComponent c, InputStream in) throws ISOException, IOException { ISOField tagField = new ISOField((Integer) c.getKey()); getTagPackager().unpack(tagField, in); ((ISOTaggedField) c).setTag(tagField.getValue().toString()); }
protected void unpackTag(ISOComponent c, InputStream in) throws ISOException, IOException { ISOField tagField = new ISOField((Integer) c.getKey()); getTagPackager().unpack(tagField, in); ((ISOTaggedField) c).setTag(tagField.getValue().toString()); }
public void testPack() throws Exception { ISOField field = new ISOField(12, "ABCD"); IFA_LLCHAR packager = new IFA_LLCHAR(10, "Should be 04ABCD"); TestUtils.assertEquals("04ABCD".getBytes(), packager.pack(field)); }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(12, origin); IFB_LLHCHAR packager = new IFB_LLHCHAR(10, "Should be Abc123:.-"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "1234567890"; ISOField f = new ISOField(12, origin); IFE_LLNUM packager = new IFE_LLNUM(10, "Should be 1234567890"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(12, origin); IFA_LLLCHAR packager = new IFA_LLLCHAR(10, "Should be Abc123:.-"); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin, (String) unpack.getValue()); } }
public void testReversability() throws Exception { String origin = "Abc123:.-"; ISOField f = new ISOField(12, origin); IFE_CHAR packager = new IFE_CHAR(10, "Should be ABCD "); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals(origin + " ", (String) unpack.getValue()); } }
public void testPack() throws Exception { ISOField field = new ISOField(12, "1234"); IFB_LLHNUM packager = new IFB_LLHNUM(10, "Should be 041234", true); TestUtils.assertEquals(new byte[]{0x04, 0x12, 0x34}, packager.pack(field)); }
public void testUnpack() throws Exception { byte[] raw = "041234 ".getBytes(); IFA_FLLNUM packager = new IFA_FLLNUM(10, "Should be 04ABCD"); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("1234", (String) field.getValue()); }
public void testUnpack() throws Exception { byte[] raw = "00004ABCD".getBytes(); IFA_LLLLLCHAR packager = new IFA_LLLLLCHAR(10, "Should be 00004ABCD"); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("ABCD", (String) field.getValue()); }
public void testPack() throws Exception { ISOField field = new ISOField(12, "123"); IFA_LLBNUM packager = new IFA_LLBNUM(10, "Should be 0x30340123", true); TestUtils.assertEquals(new byte[]{0x30, 0x34, 0x01, 0x23}, packager.pack( field)); }
@Test public void testSetFieldNumber() throws Throwable { ISOField iSOField = new ISOField(100); iSOField.setFieldNumber(1000); assertEquals("iSOField.fieldNumber", 1000, iSOField.fieldNumber); }
public void testRightPad() throws Exception { String origin = "0123456789ABCDE"; ISOField f = new ISOField(12, origin); IFB_HEX packager = new IFB_HEX(origin.length(), "Should be 00123456789ABCDE", false); ISOField unpack = new ISOField(12); packager.unpack(unpack, packager.pack(f), 0); assertEquals (origin, (String) unpack.getValue()); assertEquals ("0123456789ABCDEF", ISOUtil.hexString(packager.pack(f))); } }
@Test public void testValidateThrowsClassCastException() throws Throwable { TEST0100 tEST0100 = new TEST0100(); try { tEST0100.validate(new ISOField()); fail("Expected ClassCastException to be thrown"); } catch (ClassCastException ex) { assertEquals("ex.getClass()", ClassCastException.class, ex.getClass()); } }
public void testUnpack() throws Exception { byte[] raw = new byte[] {0x01, 0x23, 0x45, 0x67, (byte) 0x89, (byte) 0xAB, (byte) 0xCD, (byte) 0xEF} ; IFB_HEX packager = new IFB_HEX(16, "Should be 0123456789ABCDEF", true); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("0123456789ABCDEF", (String) field.getValue()); }
public void testUnpack() throws Exception { byte[] raw = new byte[] {(byte)0xF0, (byte)0xF0, (byte)0xF4, (byte)0xC1, (byte)0xC2, (byte)0xC3, (byte)0xC4}; IFE_LLLCHAR packager = new IFE_LLLCHAR(10, "Should be 04ABCD"); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("ABCD", (String) field.getValue()); }
@Test public void testPackAFullArray() throws Exception { ISOField field = new ISOField(9, "ABCDEFGHI"); IFE_LCHAR packager = new IFE_LCHAR(9, "testing packing a full Array"); TestUtils.assertEquals(new byte[] { (byte) 0xF9, (byte) 0xC1, (byte) 0xC2, (byte) 0xC3, (byte) 0xC4, (byte) 0xC5, (byte) 0xC6, (byte) 0xC7, (byte) 0xC8, (byte) 0xC9}, packager.pack(field)); }
public void testUnpack() throws Exception { byte[] raw = new byte[] {(byte)0x30, (byte)0x34, (byte)0xF1, (byte)0xF2, (byte)0xF3, (byte)0xF4}; IFAE_LLCHAR packager = new IFAE_LLCHAR(10, "Should be 041234"); ISOField field = new ISOField(12); packager.unpack(field, raw, 0); assertEquals("1234", (String) field.getValue()); }
public void testPackThrowsISOException() throws Throwable { int[] sequence = new int[0]; try { new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern").pack(new ISOField()); fail("Expected ISOException to be thrown"); } catch (ISOException ex) { assertEquals("ex.getMessage()", "Can't call VISA1 packager on non ISOMsg", ex.getMessage()); assertNull("ex.getNested()", ex.getNested()); } }
public void testUnpack() throws Exception { byte[] raw = new byte[] {(byte)0xF9, (byte)0xF2,(byte)0xF0, (byte)0xF3, (byte)0xF1, (byte)0xF2, (byte)0xF3}; IFEPE_LLCHAR packager = new IFEPE_LLCHAR(10, "Should be 0592123"); ISOField field = new ISOField(); int len = packager.unpack(field, raw, 0); assertEquals(raw.length, len); String v = (String)field.getValue(); assertEquals("123", (String) field.getValue()); assertEquals(92, field.fieldNumber); // Derived from TAG! }