use of org.jpos.iso.ISOFieldPackager 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.ISOFieldPackager in project jPOS by jpos.
the class Base1SubFieldPackagerTest method testUnpack.
@Test
public void testUnpack() throws Throwable {
Base1SubFieldPackager base1SubFieldPackager = new Base1SubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[3];
base1SubFieldPackager.setFieldPackager(fld);
base1SubFieldPackager.setLogger(new Logger(), "testBase1SubFieldPackagerRealm");
byte[] b = new byte[0];
int result = base1SubFieldPackager.unpack(new ISOMsg(100), b);
assertEquals("result", 0, result);
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsArrayIndexOutOfBoundsException.
@Test
public void testUnpackThrowsArrayIndexOutOfBoundsException() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[0];
cTCSubElementPackager.setFieldPackager(fld);
byte[] b = new byte[1];
try {
cTCSubElementPackager.unpack(new ISOMsg(), b);
fail("Expected ArrayIndexOutOfBoundsException to be thrown");
} catch (ArrayIndexOutOfBoundsException ex) {
assertEquals("ex.getMessage()", "0", ex.getMessage());
}
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsNullPointerException2.
@Test
public void testUnpackThrowsNullPointerException2() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
fld[0] = new IFA_AMOUNT();
cTCSubElementPackager.setFieldPackager(fld);
byte[] b = new byte[3];
ISOComponent m = new ISOMsg("testCTCSubElementPackagerMti");
try {
cTCSubElementPackager.unpack(m, b);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class CTCSubElementPackagerTest method testPack.
@Test
public void testPack() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
cTCSubElementPackager.setFieldPackager(fld);
byte[] result = cTCSubElementPackager.pack(new ISOBinaryField());
assertEquals("result.length", 0, result.length);
}
Aggregations