Search in sources :

Example 6 with MSGTEST02

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

the class ISOBaseValidatingPackagerTest method testValidate13.

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

Example 7 with MSGTEST02

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

the class GenericValidatingPackagerTest method testValidateThrowsNullPointerException.

@Test
public void testValidateThrowsNullPointerException() throws Throwable {
    GenericValidatingPackager genericValidatingPackager = new GenericValidatingPackager();
    ISOFieldValidator[] fvlds = new ISOFieldValidator[0];
    genericValidatingPackager.setFieldValidator(fvlds);
    ISOBaseValidator[] msgVlds = new ISOBaseValidator[2];
    msgVlds[0] = new ISOBaseValidator();
    msgVlds[1] = new MSGTEST02();
    genericValidatingPackager.setMsgValidator(msgVlds);
    try {
        genericValidatingPackager.validate(new ISOMsg());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOBaseValidator(org.jpos.iso.ISOBaseValidator) ISOFieldValidator(org.jpos.iso.ISOFieldValidator) MSGTEST02(org.jpos.iso.validator.MSGTEST02) Test(org.junit.Test)

Example 8 with MSGTEST02

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

Example 9 with MSGTEST02

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

Aggregations

ISOBaseValidator (org.jpos.iso.ISOBaseValidator)9 ISOMsg (org.jpos.iso.ISOMsg)9 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)9 Test (org.junit.Test)9 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)6 ISOVMsg (org.jpos.iso.ISOVMsg)4 ISOValidator (org.jpos.iso.ISOValidator)4 ISOComponent (org.jpos.iso.ISOComponent)2 ISOVError (org.jpos.iso.ISOVError)2 IVA_ALPHANUM (org.jpos.iso.IVA_ALPHANUM)2 IVA_ALPHANUMNOBLANK (org.jpos.iso.IVA_ALPHANUMNOBLANK)1 MSGTEST (org.jpos.iso.validator.MSGTEST)1 TEST0100 (org.jpos.iso.validator.TEST0100)1