use of org.jpos.iso.ISOField in project jPOS by jpos.
the class ISOMultiFieldPackagerTest method testPackList.
public void testPackList() throws Exception {
Vector list = new Vector();
list.add(new IFB_LLNUM(10, "Should not be this", true));
list.add(new IFE_LLNUM(10, "Should be 041234"));
list.add(new IFB_LLNUM(10, "The one to pack", true));
ISOMultiFieldPackager packager = new ISOMultiFieldPackager("Should be 041234", list);
packager.hint("The one to pack");
ISOField field = new ISOField(12, "1234");
TestUtils.assertEquals(new byte[] { (byte) 0x04, (byte) 0x12, (byte) 0x34 }, packager.pack(field));
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class VISA1PackagerTest method testPackThrowsISOException.
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());
}
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class XMLPackagerTest method testPackException.
@Test
public void testPackException() {
ISOField field = new ISOField();
try {
xMLPackager.pack(field);
fail("Exception Expected - not an isomsg");
} catch (ISOException e) {
assertThat(e.getMessage(), is("cannot pack class org.jpos.iso.ISOField"));
}
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class MSGTEST021Test method testValidateThrowsISOException.
@Test
public void testValidateThrowsISOException() throws Throwable {
try {
new MSGTEST02().validate(new ISOField());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "Can't call validate on non Composite", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class TEST01001Test method testValidateThrowsClassCastException.
@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());
}
}
Aggregations