use of org.jpos.iso.ISOFieldPackager 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.ISOFieldPackager in project jPOS by jpos.
the class EuroSubFieldPackagerTest method testUnpackThrowsNullPointerException1.
@Test
public void testUnpackThrowsNullPointerException1() throws Throwable {
EuroSubFieldPackager euroSubFieldPackager = new EuroSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[4];
fld[0] = new IFB_LLLCHAR();
euroSubFieldPackager.setFieldPackager(fld);
byte[] b = new byte[3];
try {
euroSubFieldPackager.unpack(null, 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 GenericPackagerTest method testGetFirstField.
@Test
public void testGetFirstField() throws Throwable {
GenericPackager genericValidatingPackager = new GenericValidatingPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[3];
fld[1] = new IFA_BITMAP();
genericValidatingPackager.setFieldPackager(fld);
int result = genericValidatingPackager.getFirstField();
assertEquals("result", 2, result);
}
use of org.jpos.iso.ISOFieldPackager 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.ISOFieldPackager 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