@Test public void testSetConfigurationThrowsNullPointerException() throws Throwable { GenericPackager genericSubFieldPackager = new GenericSubFieldPackager(); Configuration cfg = new SubConfiguration(); try { genericSubFieldPackager.setConfiguration(cfg); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { 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(genericSubFieldPackager.getLogger(), "(GenericSubFieldPackager) genericSubFieldPackager.getLogger()"); assertNull(genericSubFieldPackager.getRealm(), "(GenericSubFieldPackager) genericSubFieldPackager.getRealm()"); } }
public void setConfiguration (Configuration cfg) throws ConfigurationException { filename = cfg.get("packager-config", null); if (filename == null) throw new ConfigurationException("packager-config property cannot be null"); try { String loggerName = cfg.get("packager-logger"); if (loggerName != null) setLogger(Logger.getLogger (loggerName), cfg.get ("packager-realm")); logFieldName= cfg.getBoolean("packager-log-fieldname", logFieldName); readFile(filename); } catch (ISOException e) { throw new ConfigurationException(e.getMessage(), e.fillInStackTrace()); } }
GenericPackager extends ISOBasePackager implements Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { filename = cfg.get("packager-config", null); if (filename == null) throw new ConfigurationException("packager-config property cannot be null"); try { String loggerName = cfg.get("packager-logger"); if (loggerName != null) setLogger(Logger.getLogger (loggerName), cfg.get ("packager-realm")); logFieldName= cfg.getBoolean("packager-log-fieldname", logFieldName); readFile(filename); } catch (ISOException e) { throw new ConfigurationException(e.getMessage(), e.fillInStackTrace()); } } }
GenericPackager extends ISOBasePackager implements Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { filename = cfg.get("packager-config", null); if (filename == null) throw new ConfigurationException("packager-config property cannot be null"); try { String loggerName = cfg.get("packager-logger"); if (loggerName != null) setLogger(Logger.getLogger (loggerName), cfg.get ("packager-realm")); logFieldName= cfg.getBoolean("packager-log-fieldname", logFieldName); readFile(filename); } catch (ISOException e) { throw new ConfigurationException(e.getMessage(), e.fillInStackTrace()); } } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); }
GenericPackager extends ISOBasePackager implements Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { filename = cfg.get("packager-config", null); if (filename == null) throw new ConfigurationException("packager-config property cannot be null"); try { String loggerName = cfg.get("packager-logger"); if (loggerName != null) setLogger(Logger.getLogger (loggerName), cfg.get ("packager-realm")); logFieldName= cfg.getBoolean("packager-log-fieldname", logFieldName); readFile(filename); } catch (ISOException e) { throw new ConfigurationException(e.getMessage(), e.fillInStackTrace()); } } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); void setConfiguration(Configuration cfg); void readFile(String filename); void readFile(InputStream input); @Override void setLogger(Logger logger, String realm); @Override String getDescription(); }
GenericPackager extends ISOBasePackager implements Configurable { public void setConfiguration (Configuration cfg) throws ConfigurationException { filename = cfg.get("packager-config", null); if (filename == null) throw new ConfigurationException("packager-config property cannot be null"); try { String loggerName = cfg.get("packager-logger"); if (loggerName != null) setLogger(Logger.getLogger (loggerName), cfg.get ("packager-realm")); logFieldName= cfg.getBoolean("packager-log-fieldname", logFieldName); readFile(filename); } catch (ISOException e) { throw new ConfigurationException(e.getMessage(), e.fillInStackTrace()); } } GenericPackager();  GenericPackager(String filename);  GenericPackager(InputStream input); void setConfiguration(Configuration cfg); void readFile(String filename); void readFile(InputStream input); @Override void setLogger(Logger logger, String realm); @Override String getDescription();  }