@Test public void testSetConfigurationThrowsNullPointerException() throws Throwable { ProtectedLogListener protectedLogListener = new ProtectedLogListener(); Configuration cfg = new SubConfiguration(); try { protectedLogListener.setConfiguration(cfg); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertSame(cfg, protectedLogListener.cfg, "protectedLogListener.cfg"); if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.core.Configuration.get(String, String)\" because \"this.cfg\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(protectedLogListener.wipeFields, "protectedLogListener.wipeFields"); assertNull(protectedLogListener.protectFields, "protectedLogListener.protectFields"); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; protectFields = ISOUtil.toStringArray (cfg.get ("protect", "")); wipeFields = ISOUtil.toStringArray (cfg.get ("wipe", "")); }
ProtectedLogListener implements LogListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; protectFields = ISOUtil.toStringArray (cfg.get ("protect", "")); wipeFields = ISOUtil.toStringArray (cfg.get ("wipe", "")); } }
ProtectedLogListener implements LogListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; protectFields = ISOUtil.toStringArray (cfg.get ("protect", "")); wipeFields = ISOUtil.toStringArray (cfg.get ("wipe", "")); } ProtectedLogListener(); }
ProtectedLogListener implements LogListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; protectFields = ISOUtil.toStringArray (cfg.get ("protect", "")); wipeFields = ISOUtil.toStringArray (cfg.get ("wipe", "")); } ProtectedLogListener(); void setConfiguration(Configuration cfg); LogEvent log(LogEvent ev); }
ProtectedLogListener implements LogListener, Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { this.cfg = cfg; protectFields = ISOUtil.toStringArray (cfg.get ("protect", "")); wipeFields = ISOUtil.toStringArray (cfg.get ("wipe", "")); } ProtectedLogListener(); void setConfiguration(Configuration cfg); LogEvent log(LogEvent ev); static final String WIPED; static final byte[] BINARY_WIPED; }