### Question:
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);  }### Answer:
@Test public void testSetConfiguration() throws Throwable { BSHRequestListener bSHRequestListener = new BSHRequestListener(); Configuration cfg = new SimpleConfiguration(); bSHRequestListener.setConfiguration(cfg); assertEquals(1, bSHRequestListener.whitelist.size(), "bSHRequestListener.whitelist.size()"); assertEquals(0, bSHRequestListener.bshSource.length, "bSHRequestListener.bshSource.length"); assertSame(cfg, bSHRequestListener.cfg, "bSHRequestListener.cfg"); }
@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"); } }