Search in sources :

Example 1 with NACChannel

use of org.jpos.iso.channel.NACChannel in project jPOS by jpos.

the class BaseChannelTest method testGetCounters.

@Test
public void testGetCounters() throws Throwable {
    int[] result = new NACChannel().getCounters();
    assertEquals("result.length", 3, result.length);
    assertEquals("result[0]", 0, result[0]);
}
Also used : NACChannel(org.jpos.iso.channel.NACChannel) Test(org.junit.Test)

Example 2 with NACChannel

use of org.jpos.iso.channel.NACChannel in project jPOS by jpos.

the class MacroFilterTest method testFilter5.

@Test
public void testFilter5() throws Throwable {
    MacroFilter macroFilter = new MacroFilter();
    LogEvent evt = new LogEvent();
    ISOChannel channel = new NACChannel();
    when(m.getMaxField()).thenReturn(0);
    when(m.hasField(0)).thenReturn(true);
    when(m.getValue(0)).thenReturn("N/A in Composite");
    ISOMsg result = macroFilter.filter(channel, m, evt);
    assertSame("result", m, result);
}
Also used : NACChannel(org.jpos.iso.channel.NACChannel) ISOMsg(org.jpos.iso.ISOMsg) LogEvent(org.jpos.util.LogEvent) ISOChannel(org.jpos.iso.ISOChannel) Test(org.junit.Test)

Example 3 with NACChannel

use of org.jpos.iso.channel.NACChannel 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 4 with NACChannel

use of org.jpos.iso.channel.NACChannel in project jPOS by jpos.

the class BaseChannelTest method testRemoveFilter4.

@Test
public void testRemoveFilter4() throws Throwable {
    BaseChannel nACChannel = new NACChannel();
    nACChannel.removeFilter(new DelayFilter());
    assertEquals("(NACChannel) nACChannel.incomingFilters.size()", 0, ((NACChannel) nACChannel).incomingFilters.size());
    assertEquals("(NACChannel) nACChannel.outgoingFilters.size()", 0, ((NACChannel) nACChannel).outgoingFilters.size());
}
Also used : NACChannel(org.jpos.iso.channel.NACChannel) DelayFilter(org.jpos.iso.filter.DelayFilter) Test(org.junit.Test)

Example 5 with NACChannel

use of org.jpos.iso.channel.NACChannel in project jPOS by jpos.

the class DelayFilterTest method testFilterThrowsNullPointerException.

@Test
public void testFilterThrowsNullPointerException() throws Throwable {
    try {
        new DelayFilter(0).filter(new NACChannel(), new ISOMsg("testDelayFilterMti"), null);
        fail("Expected NullPointerException to be thrown");
    } catch (NullPointerException ex) {
        assertNull("ex.getMessage()", ex.getMessage());
    }
}
Also used : NACChannel(org.jpos.iso.channel.NACChannel) ISOMsg(org.jpos.iso.ISOMsg) Test(org.junit.Test)

Aggregations

NACChannel (org.jpos.iso.channel.NACChannel)5 Test (org.junit.Test)5 ISOMsg (org.jpos.iso.ISOMsg)3 LogEvent (org.jpos.util.LogEvent)2 ISOChannel (org.jpos.iso.ISOChannel)1 DelayFilter (org.jpos.iso.filter.DelayFilter)1