@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) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.util.LogEvent.addMessage(Object)\" because \"evt\" is null", ex.getMessage(), "ex.getMessage()"); } } }
public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) { evt.addMessage ("<delay-filter delay=\""+delay+"\"/>"); if (delay > 0) { try { Thread.sleep (delay); } catch (InterruptedException e) { } } return m; }
DelayFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) { evt.addMessage ("<delay-filter delay=\""+delay+"\"/>"); if (delay > 0) { try { Thread.sleep (delay); } catch (InterruptedException e) { } } return m; } }
DelayFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) { evt.addMessage ("<delay-filter delay=\""+delay+"\"/>"); if (delay > 0) { try { Thread.sleep (delay); } catch (InterruptedException e) { } } return m; } DelayFilter();  DelayFilter(int delay); }
DelayFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) { evt.addMessage ("<delay-filter delay=\""+delay+"\"/>"); if (delay > 0) { try { Thread.sleep (delay); } catch (InterruptedException e) { } } return m; } DelayFilter();  DelayFilter(int delay); void setConfiguration(Configuration cfg); ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt); }
DelayFilter implements ISOFilter, Configurable { public ISOMsg filter (ISOChannel channel, ISOMsg m, LogEvent evt) { evt.addMessage ("<delay-filter delay=\""+delay+"\"/>"); if (delay > 0) { try { Thread.sleep (delay); } catch (InterruptedException e) { } } return m; } DelayFilter();  DelayFilter(int delay); void setConfiguration(Configuration cfg); ISOMsg filter(ISOChannel channel, ISOMsg m, LogEvent evt);  }