use of org.jpos.iso.ISOException 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.ISOException in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackThrowsISOException1.
@Test
public void testUnpackThrowsISOException1() throws Throwable {
byte[] b = new byte[2];
try {
new GenericSubFieldPackager().unpack(new ISOMsg(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "java.lang.NullPointerException", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOException 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());
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testPackThrowsISOException.
@Test
public void testPackThrowsISOException() throws Throwable {
try {
new GenericSubFieldPackager().pack(new ISOMsg());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "java.lang.NullPointerException", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class GenericSubFieldPackagerTest method testUnpackThrowsISOException3.
@Test
public void testUnpackThrowsISOException3() throws Throwable {
GenericSubFieldPackager genericSubFieldPackager = new GenericSubFieldPackager();
genericSubFieldPackager.setLogger(new Logger(), "testGenericSubFieldPackagerRealm");
try {
genericSubFieldPackager.unpack(new ISOMsg(), (byte[]) null);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "java.lang.NullPointerException", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
Aggregations