Search in sources :

Example 21 with ISOVMsg

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

the class VErrorParserTest method testGetVErrors8.

@SuppressWarnings("unchecked")
@Test
public void testGetVErrors8() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOVError FirstError = new ISOVError("testVErrorParserDescription");
    ISOComponent c = new ISOVMsg(new ISOMsg(), FirstError);
    Vector result = vErrorParser.getVErrors(c);
    assertEquals("result.size()", 1, result.size());
    assertSame("result.get(0)", FirstError, result.get(0));
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOVError(org.jpos.iso.ISOVError) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Vector(java.util.Vector) Test(org.junit.Test)

Example 22 with ISOVMsg

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

the class VErrorParserTest method testGetVErrors6.

@SuppressWarnings("unchecked")
@Test
public void testGetVErrors6() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOMsg Source = new ISOVMsg(new ISOMsg(), new ISOVError("testVErrorParserDescription"));
    Source.set(100, "testVErrorParserValue");
    Vector result = vErrorParser.getVErrors(new ISOVMsg(Source));
    assertEquals("result.size()", 0, result.size());
}
Also used : ISOVError(org.jpos.iso.ISOVError) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Vector(java.util.Vector) Test(org.junit.Test)

Example 23 with ISOVMsg

use of org.jpos.iso.ISOVMsg 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 24 with ISOVMsg

use of org.jpos.iso.ISOVMsg 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);
}
Also used : IVA_ALPHANUMNOBLANK(org.jpos.iso.IVA_ALPHANUMNOBLANK) MSGTEST(org.jpos.iso.validator.MSGTEST) 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) Test(org.junit.Test)

Example 25 with ISOVMsg

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

Aggregations

ISOVMsg (org.jpos.iso.ISOVMsg)25 Test (org.junit.Test)25 ISOMsg (org.jpos.iso.ISOMsg)22 ISOVError (org.jpos.iso.ISOVError)9 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)8 ISOComponent (org.jpos.iso.ISOComponent)8 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)7 Vector (java.util.Vector)5 ISOValidator (org.jpos.iso.ISOValidator)4 MSGTEST (org.jpos.iso.validator.MSGTEST)4 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)4 IVA_ALPHANUM (org.jpos.iso.IVA_ALPHANUM)3 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 ISOChannel (org.jpos.iso.ISOChannel)1 IVA_ALPHANUMNOBLANK (org.jpos.iso.IVA_ALPHANUMNOBLANK)1 IVA_ALPHANUMNOZERO_NOBLANK (org.jpos.iso.IVA_ALPHANUMNOZERO_NOBLANK)1 CSChannel (org.jpos.iso.channel.CSChannel)1 TEST0100 (org.jpos.iso.validator.TEST0100)1 LogEvent (org.jpos.util.LogEvent)1