Search in sources :

Example 6 with ISOVMsg

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

the class MSGTEST1Test method testValidateThrowsISOVException1.

@Test
public void testValidateThrowsISOVException1() throws Throwable {
    ISOComponent m = new ISOVMsg(new ISOMsg());
    try {
        new MSGTEST(true).validate(m);
        fail("Expected ISOVException to be thrown");
    } catch (ISOVException ex) {
        assertEquals("ex.getMessage()", "Error on msg. ", ex.getMessage());
        assertFalse("ex.treated", ex.treated);
        assertSame("ex.errComponent", m, ex.errComponent);
        assertNull("ex.getNested()", ex.getNested());
    }
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 7 with ISOVMsg

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

the class MSGTEST1Test method testValidate.

@Test
public void testValidate() throws Throwable {
    MSGTEST mSGTEST = new MSGTEST();
    final ISOVMsg m = mock(ISOVMsg.class);
    given(m.getComposite()).willReturn(m);
    given(m.hasFields(new int[] { 3, 7, 11 })).willReturn(false);
    given(m.addISOVError(isA(ISOVError.class))).willReturn(true);
    ISOVMsg result = (ISOVMsg) mSGTEST.validate(m);
    assertSame("result", m, result);
}
Also used : ISOVError(org.jpos.iso.ISOVError) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 8 with ISOVMsg

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

the class MSGTEST1Test method testValidate1.

@Test
public void testValidate1() throws Throwable {
    ISOVMsg result = (ISOVMsg) new MSGTEST().validate(new ISOMsg("testMSGTESTMti"));
    assertNotNull("result", result);
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 9 with ISOVMsg

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

the class VErrorParserTest method testGetVErrorsThrowsNullPointerException1.

@Test
public void testGetVErrorsThrowsNullPointerException1() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    try {
        vErrorParser.getVErrors(new ISOVMsg(new ISOMsg(), null));
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 10 with ISOVMsg

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

the class VErrorParserTest method testGetVErrorsThrowsNullPointerException.

@Test
public void testGetVErrorsThrowsNullPointerException() throws Throwable {
    VErrorParser vErrorParser = new VErrorParser();
    ISOVMsg c = new ISOVMsg(new ISOMsg(), new ISOVError("testVErrorParserDescription"));
    c.addISOVError(null);
    try {
        vErrorParser.getVErrors(c);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOVError(org.jpos.iso.ISOVError) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) 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