use of org.jpos.iso.ISOBinaryField in project jPOS by jpos.
the class CTCSubElementPackagerTest method testPackThrowsISOException2.
@Test
public void testPackThrowsISOException2() throws Throwable {
try {
new CTCSubElementPackager().pack(new ISOBinaryField(100));
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.ISOBinaryField in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsNegativeArraySizeException.
@Test
public void testUnpackThrowsNegativeArraySizeException() throws Throwable {
byte[] b = new byte[3];
ISOFieldPackager[] fld = new ISOFieldPackager[3];
fld[0] = new IFA_LLBNUM();
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
cTCSubElementPackager.setFieldPackager(fld);
try {
cTCSubElementPackager.unpack(new ISOBinaryField(), b);
fail("Expected NegativeArraySizeException to be thrown");
} catch (NegativeArraySizeException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOBinaryField in project jPOS by jpos.
the class EuroSubFieldPackagerTest method testUnpackThrowsNullPointerException.
@Test
public void testUnpackThrowsNullPointerException() throws Throwable {
byte[] b = new byte[3];
try {
new EuroSubFieldPackager().unpack(new ISOBinaryField(100), b);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOBinaryField in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackThrowsISOException5.
@Test
public void testUnpackThrowsISOException5() throws Throwable {
byte[] b = new byte[2];
try {
new GenericSubFieldPackager().unpack(new ISOBinaryField(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "Can't call packager on non Composite", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOBinaryField 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