use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class EuroSubFieldPackagerTest method testPack.
@Test
public void testPack() throws Throwable {
EuroSubFieldPackager euroSubFieldPackager = new EuroSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[4];
euroSubFieldPackager.setFieldPackager(fld);
byte[] result = euroSubFieldPackager.pack(new ISOMsg(100));
assertEquals("result.length", 0, result.length);
}
use of org.jpos.iso.ISOMsg 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.ISOMsg in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testReturnsZero.
@Test
public void testReturnsZero() throws Throwable {
byte[] b = new byte[0];
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
int l = genericSubFieldPackager.unpack(new ISOMsg("testGenericSubFieldPackagerMti"), b);
assertEquals(0L, (long) l);
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackReturnsZero1.
@Test
public void testUnpackReturnsZero1() throws Throwable {
byte[] b = new byte[0];
ISOFieldPackager[] fld = new ISOFieldPackager[0];
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setFieldPackager(fld);
genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
int l = genericSubFieldPackager.unpack(new ISOMsg("testGenericSubFieldPackagerMti"), b);
assertEquals(0L, (long) l);
}
use of org.jpos.iso.ISOMsg in project jPOS by jpos.
the class GenericValidatingPackagerTest method testValidateThrowsNullPointerException3.
@Test
public void testValidateThrowsNullPointerException3() throws Throwable {
GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[0] = new MSGTEST02();
genericValidatingPackager.setMsgValidator(msgVlds);
ISOFieldValidator[] fvlds = new ISOFieldValidator[2];
fvlds[0] = new IVA_ALPHANUMNOBLANK(100, "testGenericValidatingPackagerDescription");
genericValidatingPackager.setFieldValidator(fvlds);
try {
genericValidatingPackager.validate(new ISOMsg());
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
Aggregations