use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class CTCSubElementPackagerTest method testPackThrowsISOException.
@Test
public void testPackThrowsISOException() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
cTCSubElementPackager.setFieldPackager(fld);
try {
cTCSubElementPackager.pack(new ISOMsg("testCTCSubElementPackagerMti"));
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getNested().getClass()", ClassCastException.class, ex.getNested().getClass());
}
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class CTCSubElementPackagerTest method testPack1.
@Test
public void testPack1() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[0];
cTCSubElementPackager.setFieldPackager(fld);
byte[] result = cTCSubElementPackager.pack(new ISOMsg());
assertEquals("result.length", 0, result.length);
}
use of org.jpos.iso.ISOMsg 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.ISOMsg in project jPOS by jpos.
the class CTCSubFieldPackagerTest method testPackThrowsISOException2.
@Test
public void testPackThrowsISOException2() throws Throwable {
CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[1];
cTCSubFieldPackager.setFieldPackager(fld);
try {
cTCSubFieldPackager.pack(new ISOMsg("testCTCSubFieldPackagerMti"));
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "null: null", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class CTCSubFieldPackagerTest method testValidateThrowsNullPointerException3.
@Test(expected = NullPointerException.class)
public void testValidateThrowsNullPointerException3() throws Throwable {
CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
cTCSubFieldPackager.setLogger(Logger.getLogger(""), "testCTCSubFieldPackagerRealm");
ISOValidator[] fvlds = new ISOValidator[2];
cTCSubFieldPackager.setFieldValidator(fvlds);
cTCSubFieldPackager.validate(new ISOMsg("testCTCSubFieldPackagerMti"));
}
Aggregations