use of org.jpos.iso.IFA_LCHAR in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsISOException1.
@Test
public void testUnpackThrowsISOException1() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
cTCSubElementPackager.setFieldPackager(fld);
cTCSubElementPackager.setFieldPackager(0, new IFA_LCHAR());
byte[] b = new byte[3];
try {
cTCSubElementPackager.unpack(new ISOMsg(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LCHAR: Problem unpacking field 0", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.IFA_LCHAR in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackThrowsISOException2.
@Test
public void testUnpackThrowsISOException2() throws Throwable {
ISOFieldPackager[] fld = new ISOFieldPackager[2];
fld[1] = new IFA_LCHAR(0, "testGenericSubFieldPackagerDescription");
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setFieldPackager(fld);
byte[] b = new byte[3];
try {
genericSubFieldPackager.unpack(new ISOMsg(100), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LCHAR: Problem unpacking field -1", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.IFA_LCHAR in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testPackThrowsISOException2.
@Test
public void testPackThrowsISOException2() throws Throwable {
ISOFieldPackager[] fld = new ISOFieldPackager[3];
fld[1] = new IFA_LCHAR(0, "testGenericSubFieldPackagerDescription");
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setFieldPackager(fld);
try {
genericSubFieldPackager.pack(new ISOBinaryField(100));
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LCHAR: Problem packing field unknown", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
Aggregations