Search in sources :

Example 26 with ISOComponent

use of org.jpos.iso.ISOComponent 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 27 with ISOComponent

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

the class VErrorParserTest method testGetVErrors10.

@SuppressWarnings("unchecked")
@Test
public void testGetVErrors10() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOComponent c = new ISOMsg("testVErrorParserMti");
    Vector result = vErrorParser.getVErrors(c);
    assertEquals("result.size()", 0, result.size());
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) Vector(java.util.Vector) Test(org.junit.Test)

Example 28 with ISOComponent

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

the class CTCSubElementPackagerTest method testUnpackThrowsNullPointerException2.

@Test
public void testUnpackThrowsNullPointerException2() throws Throwable {
    CTCSubElementPackager cTCSubElementPackager = new CTCSubElementPackager();
    ISOFieldPackager[] fld = new ISOFieldPackager[2];
    fld[0] = new IFA_AMOUNT();
    cTCSubElementPackager.setFieldPackager(fld);
    byte[] b = new byte[3];
    ISOComponent m = new ISOMsg("testCTCSubElementPackagerMti");
    try {
        cTCSubElementPackager.unpack(m, b);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) IFA_AMOUNT(org.jpos.iso.IFA_AMOUNT) ISOMsg(org.jpos.iso.ISOMsg) ISOFieldPackager(org.jpos.iso.ISOFieldPackager) Test(org.junit.Test)

Example 29 with ISOComponent

use of org.jpos.iso.ISOComponent 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 30 with ISOComponent

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

Aggregations

ISOComponent (org.jpos.iso.ISOComponent)34 ISOMsg (org.jpos.iso.ISOMsg)25 Test (org.junit.Test)23 ISOVMsg (org.jpos.iso.ISOVMsg)8 ISOException (org.jpos.iso.ISOException)6 LogEvent (org.jpos.util.LogEvent)6 Vector (java.util.Vector)5 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)5 ISOField (org.jpos.iso.ISOField)5 ISOVError (org.jpos.iso.ISOVError)5 Map (java.util.Map)4 ISOBinaryField (org.jpos.iso.ISOBinaryField)4 ISOValidator (org.jpos.iso.ISOValidator)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)3 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)3 ISOTaggedField (org.jpos.tlv.ISOTaggedField)3 TreeMap (java.util.TreeMap)2 ConfigurationException (org.jpos.core.ConfigurationException)2