use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsISOException4.
@Test
public void testValidateThrowsISOException4() throws Throwable {
ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
msgVlds[0] = new MSGTEST(false);
msgVlds[1] = new MSGTEST();
msgVlds[2] = new TEST0100(true);
ISOValidator[] fvlds = new ISOFieldValidator[3];
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
try {
iSOBaseValidatingPackager.validate(new ISOMsg());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "MTI not available", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOFieldValidator 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.ISOFieldValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsISOException6.
@Test
public void testValidateThrowsISOException6() throws Throwable {
ISOFieldValidator iVA_ALPHANUMNOBLANK = new IVA_ALPHANUMNOBLANK(true, "testISOBaseValidatingPackagerDescription");
ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
msgVlds[0] = new MSGTEST(true);
ISOFieldValidator[] fvlds = new ISOFieldValidator[3];
fvlds[0] = iVA_ALPHANUMNOBLANK;
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
try {
iSOBaseValidatingPackager.validate(new ISOMsg());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "Error on msg. ", ex.getMessage());
assertFalse("ex.treated()", ((ISOVException) ex).treated());
assertNotNull("ex.getErrComponent()", ((ISOVException) ex).getErrComponent());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsISOException3.
@Test
public void testValidateThrowsISOException3() throws Throwable {
ISOFieldValidator iVA_ALPHANUMNOBLANK = new IVA_ALPHANUMNOBLANK(true, "testISOBaseValidatingPackagerDescription");
ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
msgVlds[2] = new TEST0100(true);
ISOFieldValidator[] fvlds = new ISOFieldValidator[3];
fvlds[0] = iVA_ALPHANUMNOBLANK;
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
iSOBaseValidatingPackager.setMsgValidator(msgVlds);
try {
iSOBaseValidatingPackager.validate(new ISOMsg());
fail("Expected ISOException to be thrown");
} catch (ISOException ex) {
assertEquals("ex.getMessage()", "MTI not available", ex.getMessage());
assertNull("ex.getNested()", ex.getNested());
}
}
use of org.jpos.iso.ISOFieldValidator in project jPOS by jpos.
the class ISOBaseValidatingPackagerTest method testValidateThrowsClassCastException3.
@Test
public void testValidateThrowsClassCastException3() throws Throwable {
ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
ISOValidator[] fvlds = new ISOValidator[3];
fvlds[0] = new ISOFieldValidator("testISOBaseValidatingPackagerDescription");
fvlds[1] = new ISOBaseValidator();
iSOBaseValidatingPackager.setFieldValidator(fvlds);
try {
iSOBaseValidatingPackager.validate(new ISOMsg("testISOBaseValidatingPackagerMti"));
fail("Expected ClassCastException to be thrown");
} catch (ClassCastException ex) {
assertEquals("ex.getClass()", ClassCastException.class, ex.getClass());
}
}
Aggregations