@Test public void testUnpackThrowsISOException() throws Throwable { int[] sequence = new int[2]; VISA1Packager vISA1Packager = new VISA1Packager(sequence, 100, "testVISA1PackagerBadResultCode", "testVISA1PackagerOkPattern"); byte[] bytes = new byte[3]; try { vISA1Packager.unpack(new ISOMsg(100), new ByteArrayInputStream(bytes)); fail("Expected ISOException to be thrown"); } catch (ISOException ex) { assertEquals("not implemented", ex.getMessage(), "ex.getMessage()"); assertNull(ex.getNested(), "ex.getNested()"); } }
@Override public int unpack (ISOComponent m, byte[] b) throws ISOException { String response = new String (b); m.set (new ISOField (respField, response)); m.set (new ISOField (39, badResultCode)); if (response.startsWith (okPattern)) { String autNumber = filter.guessAutNumber (response); if (autNumber != null) { m.set (new ISOField (39, "00")); m.set (new ISOField (38, autNumber)); } } return b.length; }
VISA1Packager extends SimpleLogSource implements ISOPackager, VISA1ResponseFilter { @Override public int unpack (ISOComponent m, byte[] b) throws ISOException { String response = new String (b); m.set (new ISOField (respField, response)); m.set (new ISOField (39, badResultCode)); if (response.startsWith (okPattern)) { String autNumber = filter.guessAutNumber (response); if (autNumber != null) { m.set (new ISOField (39, "00")); m.set (new ISOField (38, autNumber)); } } return b.length; } }
VISA1Packager extends SimpleLogSource implements ISOPackager, VISA1ResponseFilter { @Override public int unpack (ISOComponent m, byte[] b) throws ISOException { String response = new String (b); m.set (new ISOField (respField, response)); m.set (new ISOField (39, badResultCode)); if (response.startsWith (okPattern)) { String autNumber = filter.guessAutNumber (response); if (autNumber != null) { m.set (new ISOField (39, "00")); m.set (new ISOField (38, autNumber)); } } return b.length; } VISA1Packager(int[] sequence, int respField, String badResultCode, String okPattern); }
VISA1Packager extends SimpleLogSource implements ISOPackager, VISA1ResponseFilter { @Override public int unpack (ISOComponent m, byte[] b) throws ISOException { String response = new String (b); m.set (new ISOField (respField, response)); m.set (new ISOField (39, badResultCode)); if (response.startsWith (okPattern)) { String autNumber = filter.guessAutNumber (response); if (autNumber != null) { m.set (new ISOField (39, "00")); m.set (new ISOField (38, autNumber)); } } return b.length; } VISA1Packager(int[] sequence, int respField, String badResultCode, String okPattern); void setVISA1ResponseFilter(VISA1ResponseFilter filter); @Override byte[] pack(ISOComponent c); String guessAutNumber(String s); @Override int unpack(ISOComponent m, byte[] b); void unpack(ISOComponent m, InputStream in); String getFieldDescription(ISOComponent m, int fldNumber); String getDescription(); ISOMsg createISOMsg(); }
VISA1Packager extends SimpleLogSource implements ISOPackager, VISA1ResponseFilter { @Override public int unpack (ISOComponent m, byte[] b) throws ISOException { String response = new String (b); m.set (new ISOField (respField, response)); m.set (new ISOField (39, badResultCode)); if (response.startsWith (okPattern)) { String autNumber = filter.guessAutNumber (response); if (autNumber != null) { m.set (new ISOField (39, "00")); m.set (new ISOField (38, autNumber)); } } return b.length; } VISA1Packager(int[] sequence, int respField, String badResultCode, String okPattern); void setVISA1ResponseFilter(VISA1ResponseFilter filter); @Override byte[] pack(ISOComponent c); String guessAutNumber(String s); @Override int unpack(ISOComponent m, byte[] b); void unpack(ISOComponent m, InputStream in); String getFieldDescription(ISOComponent m, int fldNumber); String getDescription(); ISOMsg createISOMsg(); static final byte[] FS; }