Search in sources :

Example 16 with ISOMsg

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

the class ISOVException1Test method testConstructor.

@Test
public void testConstructor() throws Throwable {
    ISOComponent errComponent = new ISOMsg("testISOVExceptionMti");
    ISOVException iSOVException = new ISOVException("testISOVExceptionDescription", errComponent);
    assertSame("iSOVException.errComponent", errComponent, iSOVException.errComponent);
    assertEquals("iSOVException.getMessage()", "testISOVExceptionDescription", iSOVException.getMessage());
    assertFalse("iSOVException.treated", iSOVException.treated);
    assertNull("iSOVException.getNested()", iSOVException.getNested());
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 17 with ISOMsg

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

the class MSGTEST021Test method testValidate2.

@Test
public void testValidate2() throws Throwable {
    ISOMsg m = new ISOVMsg(new ISOMsg("testMSGTEST02Mti"), new ISOVError("testMSGTEST02Description"));
    m.set(1, "testMSGTEST02Value");
    ISOMsg result = (ISOMsg) new MSGTEST02().validate(m);
    assertSame("result", m, result);
}
Also used : ISOVError(org.jpos.iso.ISOVError) ISOMsg(org.jpos.iso.ISOMsg) ISOVMsg(org.jpos.iso.ISOVMsg) Test(org.junit.Test)

Example 18 with ISOMsg

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

the class MSGTEST021Test method testValidateThrowsISOVException.

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

Example 19 with ISOMsg

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

the class MSGTEST021Test method testValidateThrowsNullPointerException3.

@Test
public void testValidateThrowsNullPointerException3() throws Throwable {
    ISOMsg m = new ISOMsg("testMSGTEST02Mti");
    m.setMTI("testMSGTEST02Mti");
    m.setRetransmissionMTI();
    try {
        new MSGTEST02().validate(m);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Example 20 with ISOMsg

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

the class MSGTEST021Test method testValidateThrowsISOVException1.

@Test
public void testValidateThrowsISOVException1() throws Throwable {
    ISOComponent m = new ISOVMsg(new ISOMsg("testMSGTEST02Mti"));
    try {
        new MSGTEST02(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)

Aggregations

ISOMsg (org.jpos.iso.ISOMsg)223 Test (org.junit.Test)191 LogEvent (org.jpos.util.LogEvent)41 ISOBaseValidator (org.jpos.iso.ISOBaseValidator)30 ISOException (org.jpos.iso.ISOException)29 ISOComponent (org.jpos.iso.ISOComponent)25 ISOVMsg (org.jpos.iso.ISOVMsg)22 ISOFieldValidator (org.jpos.iso.ISOFieldValidator)21 Context (org.jpos.transaction.Context)20 ISOValidator (org.jpos.iso.ISOValidator)18 Result (org.jpos.rc.Result)17 SimpleConfiguration (org.jpos.core.SimpleConfiguration)15 ISOFieldPackager (org.jpos.iso.ISOFieldPackager)12 TEST0100 (org.jpos.iso.validator.TEST0100)12 FileInputStream (java.io.FileInputStream)9 Vector (java.util.Vector)9 PostChannel (org.jpos.iso.channel.PostChannel)9 MSGTEST (org.jpos.iso.validator.MSGTEST)9 MSGTEST02 (org.jpos.iso.validator.MSGTEST02)9 ISOFilter (org.jpos.iso.ISOFilter)8