Search in sources :

Example 21 with GenericPackager

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

the class StatefulFilterTest method testFilterThrowsNullPointerException3.

@Test
public void testFilterThrowsNullPointerException3() throws Throwable {
    int[] key = new int[0];
    StatefulFilter statefulFilter = new StatefulFilter();
    statefulFilter.setKey(key);
    statefulFilter.setSpace((Space) null);
    try {
        statefulFilter.filter(new CSChannel("testStatefulFilterHost", 100, new GenericPackager()), new ISOMsg("testStatefulFilterMti"), new LogEvent("testStatefulFilterTag", "testString"));
        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.inp(Object)\" because the return value of \"org.jpos.iso.filter.StatefulFilter.getSpace()\" is null", ex.getMessage(), "ex.getMessage()");
        }
    }
}
Also used : GenericPackager(org.jpos.iso.packager.GenericPackager) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) CSChannel(org.jpos.iso.channel.CSChannel) Test(org.junit.jupiter.api.Test)

Aggregations

GenericPackager (org.jpos.iso.packager.GenericPackager)21 Test (org.junit.jupiter.api.Test)20 ISOMsg (org.jpos.iso.ISOMsg)8 FileInputStream (java.io.FileInputStream)7 GenericTagSequence (org.jpos.tlv.GenericTagSequence)5 LiteralTagValue (org.jpos.tlv.LiteralTagValue)4 ISOPackager (org.jpos.iso.ISOPackager)3 ISOField (org.jpos.iso.ISOField)2 HEXChannel (org.jpos.iso.channel.HEXChannel)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 ObjectOutput (java.io.ObjectOutput)1 ObjectOutputStream (java.io.ObjectOutputStream)1 Configuration (org.jpos.core.Configuration)1 SimpleConfiguration (org.jpos.core.SimpleConfiguration)1 SubConfiguration (org.jpos.core.SubConfiguration)1 ASCIIChannel (org.jpos.iso.channel.ASCIIChannel)1 CSChannel (org.jpos.iso.channel.CSChannel)1 PADChannel (org.jpos.iso.channel.PADChannel)1 ISOMsgRef (org.jpos.tlv.ISOMsgRef)1