use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class CTCSubFieldPackagerTest method testPack1.
@Test
public void testPack1() throws Throwable {
CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[1];
cTCSubFieldPackager.setFieldPackager(fld);
byte[] result = cTCSubFieldPackager.pack(new ISOField());
assertEquals("result.length", 0, result.length);
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class EuroSubFieldPackagerTest method testPack3.
@Test
public void testPack3() throws Throwable {
EuroSubFieldPackager euroSubFieldPackager = new EuroSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[1];
euroSubFieldPackager.setFieldPackager(fld);
byte[] result = euroSubFieldPackager.pack(new ISOField());
assertEquals("result.length", 0, result.length);
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class GenericPackagerTest method testGetBitMapfieldPackager.
@Test
public void testGetBitMapfieldPackager() throws Throwable {
ISOFieldPackager iFA_AMOUNT = new IFA_AMOUNT();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
fld[1] = iFA_AMOUNT;
GenericPackager genericPackager = new GenericPackager();
genericPackager.setFieldPackager(fld);
ISOFieldPackager result = genericPackager.getBitMapfieldPackager();
assertSame("result", iFA_AMOUNT, result);
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackThrowsISOException8.
@Test
public void testUnpackThrowsISOException8() throws Throwable {
ISOFieldPackager[] fld = new ISOFieldPackager[2];
fld[1] = new IFA_LLLLCHAR();
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setFieldPackager(fld);
genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
byte[] b = new byte[5];
try {
genericSubFieldPackager.unpack(new ISOMsg(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LLLLCHAR: Problem unpacking field -1", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOFieldPackager in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackThrowsISOException.
@Test
public void testUnpackThrowsISOException() throws Throwable {
ISOFieldPackager[] fld = new ISOFieldPackager[0];
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setFieldPackager(fld);
byte[] b = new byte[2];
try {
genericSubFieldPackager.unpack(new ISOMsg(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
// assertEquals("ex.getMessage()", "java.lang.ArrayIndexOutOfBoundsException: 1", ex.getMessage());
// assertEquals("ex.getNested().getMessage()", "1", ex.getNested().getMessage());
}
}
Aggregations