use of org.jpos.iso.ISOValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidate4.
@Test
public void testValidate4() throws Throwable {
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
ISOValidator[] fvlds = new ISOValidator[2];
fvlds[0] = new ISOFieldValidator(100, 1000, "testISOBaseValidatingPackagerDescription");
fvlds[1] = new IVA_ALPHANUMNOBLANK(true, "testISOBaseValidatingPackagerDescription");
iSOBaseValidatingPackager.setFieldValidator(fvlds);
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[0] = new ISOBaseValidator(true);
msgVlds[1] = new MSGTEST();
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
ISOVMsg result = (ISOVMsg) iSOBaseValidatingPackager.validate(new ISOMsg(100));
assertNotNull("result", result);
}
use of org.jpos.iso.ISOValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsNullPointerException3.
@Test
public void testValidateThrowsNullPointerException3() throws Throwable {
ISOVError FirstError = new ISOVError("testISOBaseValidatingPackagerDescription", "testISOBaseValidatingPackagerRejectCode");
ISOBaseValidator[] msgVlds = new ISOBaseValidator[1];
msgVlds[0] = new MSGTEST02();
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
ISOComponent m = new ISOVMsg(new ISOMsg(), FirstError);
ISOValidator[] fvlds = new ISOValidator[0];
iSOBaseValidatingPackager.setFieldValidator(fvlds);
try {
iSOBaseValidatingPackager.validate(m);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.iso.ISOValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsClassCastException2.
@Test
public void testValidateThrowsClassCastException2() throws Throwable {
ISOValidator[] fvlds = new ISOValidator[3];
fvlds[1] = new ISOBaseValidator();
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
try {
iSOBaseValidatingPackager.validate(new ISOMsg());
fail("Expected ClassCastException to be thrown");
} catch (ClassCastException ex) {
assertEquals("ex.getClass()", ClassCastException.class, ex.getClass());
}
}
use of org.jpos.iso.ISOValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidate10.
@Test
public void testValidate10() throws Throwable {
ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
msgVlds[0] = new TEST0100(true);
ISOValidator[] fvlds = new ISOValidator[0];
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
ISOComponent m = new ISOMsg("testISOBaseValidatingPackagerMti");
ISOMsg result = (ISOMsg) iSOBaseValidatingPackager.validate(m);
assertSame("result", m, result);
}
use of org.jpos.iso.ISOValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsNullPointerException.
@Test
public void testValidateThrowsNullPointerException() throws Throwable {
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
msgVlds[2] = new MSGTEST02();
ISOValidator[] fvlds = new ISOValidator[0];
iSOBaseValidatingPackager.setFieldValidator(fvlds);
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
ISOMsg m = new ISOMsg();
m.setMTI("testISOBaseValidatingPackagerMti");
m.setRetransmissionMTI();
try {
iSOBaseValidatingPackager.validate(m);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
Aggregations