use of org.jpos.iso.ISOException 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.ISOException in project jPOS by jpos.
the class FSDProtectedLogListener method log.
public synchronized LogEvent log(LogEvent ev) {
synchronized (ev.getPayLoad()) {
final List<Object> payLoad = ev.getPayLoad();
int size = payLoad.size();
for (int i = 0; i < size; i++) {
Object obj = payLoad.get(i);
if (obj instanceof FSDISOMsg) {
FSDISOMsg m = (FSDISOMsg) ((FSDISOMsg) obj).clone();
try {
checkTruncated(m);
checkProtected(m);
checkHidden(m);
} catch (ISOException e) {
ev.addMessage(e);
}
payLoad.set(i, m);
}
}
}
return ev;
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsISOException1.
@Test
public void testUnpackThrowsISOException1() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
cTCSubElementPackager.setFieldPackager(fld);
cTCSubElementPackager.setFieldPackager(0, new IFA_LCHAR());
byte[] b = new byte[3];
try {
cTCSubElementPackager.unpack(new ISOMsg(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LCHAR: Problem unpacking field 0", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class CTCSubFieldPackagerTest method testUnpackThrowsISOException.
@Test
public void testUnpackThrowsISOException() throws Throwable {
CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[6];
fld[0] = new IFA_LLLLCHAR(100, "testCTCSubFieldPackagerDescription");
cTCSubFieldPackager.setFieldPackager(fld);
byte[] b = new byte[4];
try {
cTCSubFieldPackager.unpack(new ISOField(), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "org.jpos.iso.IFA_LLLLCHAR: Problem unpacking field 0", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
use of org.jpos.iso.ISOException in project jPOS by jpos.
the class CTCSubFieldPackagerTest method testPackThrowsISOException2.
@Test
public void testPackThrowsISOException2() throws Throwable {
CTCSubFieldPackager cTCSubFieldPackager = new CTCSubFieldPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[1];
cTCSubFieldPackager.setFieldPackager(fld);
try {
cTCSubFieldPackager.pack(new ISOMsg("testCTCSubFieldPackagerMti"));
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "null: null", ex.getMessage());
assertNull("ex.getNested().getMessage()", ex.getNested().getMessage());
}
}
Aggregations