Search in sources :

Example 21 with PostPackager

use of org.jpos.iso.packager.PostPackager in project jPOS by jpos.

the class StatefulFilterTest method testFilterThrowsNullPointerException10.

@Test
public void testFilterThrowsNullPointerException10() throws Throwable {
    StatefulFilter statefulFilter = new StatefulFilter();
    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) {
        if (isJavaVersionAtMost(JAVA_14)) {
            assertNull(ex.getMessage(), "ex.getMessage()");
        } else {
            assertEquals("Cannot invoke \"org.jpos.space.Space.out(Object, Object, long)\" because the return value of \"org.jpos.iso.filter.StatefulFilter.getSpace()\" is null", 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.jupiter.api.Test)

Aggregations

PostPackager (org.jpos.iso.packager.PostPackager)21 Test (org.junit.jupiter.api.Test)21 ISOMsg (org.jpos.iso.ISOMsg)8 CSChannel (org.jpos.iso.channel.CSChannel)8 LogEvent (org.jpos.util.LogEvent)7 SimpleConfiguration (org.jpos.core.SimpleConfiguration)3 ISOFilter (org.jpos.iso.ISOFilter)3 ISOPackager (org.jpos.iso.ISOPackager)3 ServerSocket (java.net.ServerSocket)2 BASE24TCPChannel (org.jpos.iso.channel.BASE24TCPChannel)2 XMLChannel (org.jpos.iso.channel.XMLChannel)2 EOFException (java.io.EOFException)1 Collection (java.util.Collection)1 PADChannel (org.jpos.iso.channel.PADChannel)1 PostChannel (org.jpos.iso.channel.PostChannel)1 EuroSubFieldPackager (org.jpos.iso.packager.EuroSubFieldPackager)1