Search in sources :

Example 16 with ISOValidator

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

the class ISOBaseValidatingPackagerTest method testValidate3.

@Test
public void testValidate3() throws Throwable {
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[1];
    msgVlds[0] = new TEST0100();
    ISOValidator[] fvlds = new ISOValidator[0];
    ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
    iSOBaseValidatingPackager.setFieldValidator(fvlds);
    iSOBaseValidatingPackager.setMsgValidator(msgVlds);
    ISOMsg m = new ISOMsg("testISOBaseValidatingPackagerMti");
    m.setMTI("testISOBaseValidatingPackagerMti");
    ISOMsg result = (ISOMsg) iSOBaseValidatingPackager.validate(m);
    assertSame("result", m, result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOValidator(org.jpos.iso.ISOValidator) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) TEST0100(org.jpos.iso.validator.TEST0100) Test(org.junit.Test)

Example 17 with ISOValidator

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

the class ISOBaseValidatingPackagerTest method testValidateThrowsClassCastException.

@Test
public void testValidateThrowsClassCastException() throws Throwable {
    ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
    ISOValidator[] fvlds = new ISOValidator[2];
    fvlds[0] = new ISOBaseValidator();
    iSOBaseValidatingPackager.setFieldValidator(fvlds);
    try {
        iSOBaseValidatingPackager.validate(new ISOMsg());
        fail("Expected ClassCastException to be thrown");
    } catch (ClassCastException ex) {
        assertEquals("ex.getClass()", ClassCastException.class, ex.getClass());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOValidator(org.jpos.iso.ISOValidator) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) Test(org.junit.Test)

Example 18 with ISOValidator

use of org.jpos.iso.ISOValidator 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());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOValidator(org.jpos.iso.ISOValidator) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) Test(org.junit.Test)

Example 19 with ISOValidator

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

the class ISOBaseValidatingPackagerTest method testValidate14.

@Test
public void testValidate14() throws Throwable {
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
    msgVlds[0] = new TEST0100(true);
    ISOBaseValidatingPackager iSOBaseValidatingPackager = new ISOBaseValidatingPackager();
    iSOBaseValidatingPackager.setMsgValidator(msgVlds);
    ISOValidator[] fvlds = new ISOValidator[5];
    fvlds[1] = new ISOFieldValidator();
    iSOBaseValidatingPackager.setFieldValidator(fvlds);
    ISOComponent m = new ISOMsg("testISOBaseValidatingPackagerMti");
    ISOMsg result = (ISOMsg) iSOBaseValidatingPackager.validate(m);
    assertSame("result", m, result);
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) ISOValidator(org.jpos.iso.ISOValidator) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) TEST0100(org.jpos.iso.validator.TEST0100) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) Test(org.junit.Test)

Aggregations

ISOValidator (org.jpos.iso.ISOValidator)19 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)18 ISOMsg (org.jpos.iso.ISOMsg)18 Test (org.junit.Test)18 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)9 TEST0100 (org.jpos.iso.validator.TEST0100)8 ISOComponent (org.jpos.iso.ISOComponent)4 ISOVMsg (org.jpos.iso.ISOVMsg)4 MSGTEST (org.jpos.iso.validator.MSGTEST)4 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)4 ISOException (org.jpos.iso.ISOException)3 IVA_ALPHANUMNOBLANK (org.jpos.iso.IVA_ALPHANUMNOBLANK)2 ISOVError (org.jpos.iso.ISOVError)1 IVA_ALPHANUMNOZERO_NOBLANK (org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK)1 ISOVException (org.jpos.iso.validator.ISOVException)1 LogEvent (org.jpos.util.LogEvent)1