Search in sources :

Example 6 with IVA_ALPHANUM

use of org.jpos.iso.IVA_ALPHANUM in project jPOS by jpos.

the class GenericValidatingPackagerTest method testValidateThrowsISOVException.

@Test
public void testValidateThrowsISOVException() throws Throwable {
    GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
    msgVlds[0] = new MSGTEST(false);
    msgVlds[1] = new MSGTEST(true);
    genericValidatingPackager.setMsgValidator(msgVlds);
    ISOFieldValidator[] fvlds = new ISOFieldValidator[1];
    fvlds[0] = new IVA_ALPHANUM("testGenericValidatingPackagerDescription");
    genericValidatingPackager.setFieldValidator(fvlds);
    try {
        genericValidatingPackager.validate(new ISOMsg(100));
        fail("Expected ISOVException to be thrown");
    } catch (ISOVException ex) {
        assertEquals("ex.getMessage()", "Error on msg. ", ex.getMessage());
        assertFalse("ex.treated()", ex.treated());
        assertNotNull("ex.getErrComponent()", ex.getErrComponent());
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : MSGTEST(org.jpos.iso.validator.MSGTEST) ISOMsg(org.jpos.iso.ISOMsg) IVA_ALPHANUM(org.jpos.iso.IVA_ALPHANUM) ISOVException(org.jpos.iso.validator.ISOVException) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) Test(org.junit.Test)

Aggregations

IVA_ALPHANUM (org.jpos.iso.IVA_ALPHANUM)6 Test (org.junit.Test)6 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)5 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)5 ISOMsg (org.jpos.iso.ISOMsg)5 ISOVMsg (org.jpos.iso.ISOVMsg)3 MSGTEST (org.jpos.iso.validator.MSGTEST)2 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)2 ObjectName (javax.management.ObjectName)1 ISOComponent (org.jpos.iso.ISOComponent)1 ISOException (org.jpos.iso.ISOException)1 ISOVError (org.jpos.iso.ISOVError)1 ISOVException (org.jpos.iso.validator.ISOVException)1 TEST0100 (org.jpos.iso.validator.TEST0100)1