Search in sources :

Example 6 with TEST0100

use of org.jpos.iso.validator.TEST0100 in project jPOS by jpos.

the class ISOBaseValidatingPackagerTest method testValidateThrowsISOException2.

@Test
public void testValidateThrowsISOException2() throws Throwable {
    ISOFieldValidator iVA_ALPHANUMNOBLANK = new IVA_ALPHANUMNOBLANK(true, "testISOBaseValidatingPackagerDescription");
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[3];
    msgVlds[0] = new MSGTEST(false);
    msgVlds[1] = new MSGTEST();
    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());
    }
}
Also used : IVA_ALPHANUMNOBLANK(org.jpos.iso.IVA_ALPHANUMNOBLANK) MSGTEST(org.jpos.iso.validator.MSGTEST) ISOException(org.jpos.iso.ISOException) ISOMsg(org.jpos.iso.ISOMsg) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) TEST0100(org.jpos.iso.validator.TEST0100) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) Test(org.junit.Test)

Example 7 with TEST0100

use of org.jpos.iso.validator.TEST0100 in project jPOS by jpos.

the class ISOBaseValidatingPackagerTest method testValidate18.

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

Example 8 with TEST0100

use of org.jpos.iso.validator.TEST0100 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());
    }
}
Also used : MSGTEST(org.jpos.iso.validator.MSGTEST) ISOException(org.jpos.iso.ISOException) 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)

Example 9 with TEST0100

use of org.jpos.iso.validator.TEST0100 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);
}
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) Test(org.junit.Test)

Example 10 with TEST0100

use of org.jpos.iso.validator.TEST0100 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)

Aggregations

ISOBaseValidator (org.jpos.iso.ISOBaseValidator)12 ISOMsg (org.jpos.iso.ISOMsg)12 TEST0100 (org.jpos.iso.validator.TEST0100)12 Test (org.junit.Test)12 ISOValidator (org.jpos.iso.ISOValidator)8 ISOException (org.jpos.iso.ISOException)7 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)7 MSGTEST (org.jpos.iso.validator.MSGTEST)4 IVA_ALPHANUMNOBLANK (org.jpos.iso.IVA_ALPHANUMNOBLANK)3 ISOComponent (org.jpos.iso.ISOComponent)2 ISOVMsg (org.jpos.iso.ISOVMsg)1 IVA_ALPHANUM (org.jpos.iso.IVA_ALPHANUM)1 IVA_ALPHANUMNOZERO_NOBLANK (org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK)1 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)1