use of org.jpos.iso.packager.GenericSubFieldPackager 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) {
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()");
}
}
}
use of org.jpos.iso.packager.GenericSubFieldPackager 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) {
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()");
}
}
}
use of org.jpos.iso.packager.GenericSubFieldPackager in project jPOS by jpos.
the class StatefulFilterTest method testFilterThrowsNullPointerException.
@Test
public void testFilterThrowsNullPointerException() 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);
try {
statefulFilter.filter(new PostChannel("testStatefulFilterHost", 100, new GenericSubFieldPackager()), m, 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()");
}
}
}
use of org.jpos.iso.packager.GenericSubFieldPackager in project jPOS by jpos.
the class MacroFilterTest method testFilter3.
@Test
public void testFilter3() throws Throwable {
MacroFilter macroFilter = new MacroFilter();
ISOChannel channel = new PADChannel(new GenericSubFieldPackager());
LogEvent evt = new LogEvent();
when(m.getMaxField()).thenReturn(0);
when(m.hasField(0)).thenReturn(false);
ISOMsg result = macroFilter.filter(channel, m, evt);
assertSame(m, result, "result");
}
Aggregations