use of org.jpos.iso.ISOField in project jPOS by jpos.
the class VErrorParserTest method testGetVErrors1.
@SuppressWarnings("unchecked")
@Test
public void testGetVErrors1() throws Throwable {
VErrorParser vErrorParser = new VErrorParser();
ISOVError FirstError = new ISOVError("testVErrorParserDescription");
ISOComponent c = new ISOVField(new ISOField(), FirstError);
Vector result = vErrorParser.getVErrors(c);
assertEquals("result.size()", 1, result.size());
assertSame("result.get(0)", FirstError, result.get(0));
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class VErrorParserTest method testGetVErrorsThrowsNullPointerException3.
@Test
public void testGetVErrorsThrowsNullPointerException3() throws Throwable {
VErrorParser vErrorParser = new VErrorParser();
ISOVField c = new ISOVField(new ISOField(100, "testVErrorParserv"));
c.addISOVError(null);
try {
vErrorParser.getVErrors(c);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsISOException.
@Test
public void testUnpackThrowsISOException() throws Throwable {
CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
ISOFieldPackager[] fld = new ISOFieldPackager[2];
cTCSubElementPackager.setFieldPackager(fld);
cTCSubElementPackager.setLogger(new Logger(), "testCTCSubElementPackagerRealm");
cTCSubElementPackager.setFieldPackager(0, new IFE_CHAR());
byte[] b = new byte[2];
try {
cTCSubElementPackager.unpack(new ISOVField(new ISOField(100, "testCTCSubElementPackagerv"), null), b);
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "Can't add to Leaf", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOField in project jPOS by jpos.
the class CTCSubElementPackagerTest method testUnpackThrowsNullPointerException.
@Test
public void testUnpackThrowsNullPointerException() throws Throwable {
byte[] b = new byte[3];
try {
new CTCSubElementPackager().unpack(new ISOField(100), b);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOField 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());
}
}
Aggregations