use of org.jpos.util.LogEvent in project jPOS by jpos.
the class MacroFilterTest method testFilterThrowsNullPointerException.
@Test
public void testFilterThrowsNullPointerException() throws Throwable {
MacroFilter macroFilter = new MacroFilter();
LogEvent evt = new LogEvent();
try {
macroFilter.filter(new PADChannel("testMacroFilterHost", 100, new XMLPackager()), null, evt);
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
assertNull("macroFilter.cfg", macroFilter.cfg);
assertNull("macroFilter.seq", macroFilter.seq);
}
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class MacroFilterTest method testFilter6.
@Test
public void testFilter6() throws Throwable {
ISOMsg m = new ISOMsg(100);
m.set(100, "");
ISOMsg result = new MacroFilter().filter(new CSChannel(new ISOBaseValidatingPackager()), m, new LogEvent("testMacroFilterTag", ""));
assertEquals("result.getDirection()", 0, result.getDirection());
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class MacroFilterTest method testFilter.
@Test
public void testFilter() throws Throwable {
MacroFilter macroFilter = new MacroFilter();
ISOChannel channel = new GZIPChannel(new X92GenericPackager());
LogEvent evt = new LogEvent("testMacroFilterTag", "\u0000\u0000");
when(m.getMaxField()).thenReturn(0);
ISOMsg result = macroFilter.filter(channel, m, evt);
assertSame("result", m, result);
verify(m).hasField(0);
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class StatefulFilterTest method testFilterThrowsNullPointerException5.
@Test
public void testFilterThrowsNullPointerException5() throws Throwable {
StatefulFilter statefulFilter = new StatefulFilter();
statefulFilter.setSpace((Space) null);
try {
statefulFilter.filter(new GZIPChannel(), new ISOMsg("testStatefulFilterMti"), new LogEvent());
fail("Expected NullPointerException to be thrown");
} catch (NullPointerException ex) {
assertNull("ex.getMessage()", ex.getMessage());
}
}
use of org.jpos.util.LogEvent in project jPOS by jpos.
the class StatefulFilterTest method testFilter5.
@Test
public void testFilter5() throws Throwable {
StatefulFilter statefulFilter = new StatefulFilter();
BASE24TCPChannel iSOChannel = mock(BASE24TCPChannel.class);
LogEvent evt = mock(LogEvent.class);
ISOMsg m = mock(ISOMsg.class);
given(m.getString(11)).willReturn(null);
given(m.getString(41)).willReturn(null);
given(m.getDirection()).willReturn(0);
ISOMsg result = statefulFilter.filter(iSOChannel, m, evt);
assertSame("result", m, result);
}
Aggregations