Search in sources :

Example 56 with ISOMsg

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

the class StatefulFilterTest method testFilterThrowsNullPointerException4.

@Test
public void testFilterThrowsNullPointerException4() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    m.setDirection(100);
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(100);
    statefulFilter.setSavedFields(null);
    try {
        statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new GenericSubFieldPackager()), m, new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) GenericSubFieldPackager(org.jpos.iso.packager.GenericSubFieldPackager) Test(org.junit.Test)

Example 57 with ISOMsg

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

the class StatefulFilterTest method testFilter1.

@Test
public void testFilter1() throws Throwable {
    ISOMsg m = new ISOMsg("testStatefulFilterMti");
    m.setDirection(1);
    ISOMsg result = new StatefulFilter().filter(new NACChannel(), m, new LogEvent());
    assertSame("result", m, result);
}
Also used : NACChannel(org.jpos.iso.channel.NACChannel) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) Test(org.junit.Test)

Example 58 with ISOMsg

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

the class StatefulFilterTest method testFilterThrowsNullPointerException8.

@Test
public void testFilterThrowsNullPointerException8() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(0);
    statefulFilter.setSavedFields(null);
    statefulFilter.setIgnoredFields(null);
    try {
        statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100, new PostPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) PostPackager(org.jpos.iso.packager.PostPackager) LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.Test)

Example 59 with ISOMsg

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

the class StatefulFilterTest method testFilterThrowsNullPointerException9.

@Test
public void testFilterThrowsNullPointerException9() throws Throwable {
    ISOMsg m = new ISOMsg(100);
    m.setDirection(100);
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setSpace((Space) null);
    statefulFilter.setMatchDirection(100);
    statefulFilter.setSavedFields(null);
    try {
        statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new GenericSubFieldPackager()), m, new LogEvent());
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) PostChannel(org.jpos.iso.channel.PostChannel) GenericSubFieldPackager(org.jpos.iso.packager.GenericSubFieldPackager) Test(org.junit.Test)

Example 60 with ISOMsg

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

the class Base1_BITMAP126Test method testUnpackThrowsArrayIndexOutOfBoundsException.

@Test
public void testUnpackThrowsArrayIndexOutOfBoundsException() throws Throwable {
    byte[] b = new byte[0];
    ISOComponent c = new ISOMsg();
    try {
        new Base1_BITMAP126().unpack(c, b, 100);
        fail("Expected ArrayIndexOutOfBoundsException to be thrown");
    } catch (ArrayIndexOutOfBoundsException ex) {
        assertEquals("ex.getMessage()", "100", ex.getMessage());
        assertEquals("(ISOMsg) c.getDirection()", 0, ((ISOMsg) c).getDirection());
    }
}
Also used : ISOComponent(org.jpos.iso.ISOComponent) ISOMsg(org.jpos.iso.ISOMsg) 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