@Test public void testSetConfigurationThrowsNullPointerException() throws Throwable { BSHRequestListener bSHRequestListener = new BSHRequestListener(); Configuration cfg = new SubConfiguration(); try { bSHRequestListener.setConfiguration(cfg); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertSame(cfg, bSHRequestListener.cfg, "bSHRequestListener.cfg"); if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.core.Configuration.getAll(String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(bSHRequestListener.whitelist, "bSHRequestListener.whitelist"); assertNull(bSHRequestListener.bshSource, "bSHRequestListener.bshSource"); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; bshSource = cfg.getAll ("source"); String[] mti = cfg.get ("whitelist", "*").split(","); whitelist = new HashSet<>( Arrays.asList(mti) ); }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; bshSource = cfg.getAll ("source"); String[] mti = cfg.get ("whitelist", "*").split(","); whitelist = new HashSet<>( Arrays.asList(mti) ); } }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; bshSource = cfg.getAll ("source"); String[] mti = cfg.get ("whitelist", "*").split(","); whitelist = new HashSet<>( Arrays.asList(mti) ); } BSHRequestListener(); }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; bshSource = cfg.getAll ("source"); String[] mti = cfg.get ("whitelist", "*").split(","); whitelist = new HashSet<>( Arrays.asList(mti) ); } BSHRequestListener(); void setConfiguration(Configuration cfg); boolean process(ISOSource source, ISOMsg m); }
BSHRequestListener extends Log implements ISORequestListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; bshSource = cfg.getAll ("source"); String[] mti = cfg.get ("whitelist", "*").split(","); whitelist = new HashSet<>( Arrays.asList(mti) ); } BSHRequestListener(); void setConfiguration(Configuration cfg); boolean process(ISOSource source, ISOMsg m);  }