### Question:
DirPoll extends SimpleLogSource implements Runnable, FilenameFilter, Configurable, Destroyable { public void setConfiguration (Configuration cfg) throws ConfigurationException { if (cfg != null) { if (processor instanceof Configurable) { ((Configurable) processor).setConfiguration (cfg); } setRequestDir (cfg.get ("request.dir", "request")); setResponseDir(cfg.get("response.dir", "response")); setTmpDir(cfg.get("tmp.dir", "tmp")); setRunDir(cfg.get("run.dir", "run")); setBadDir(cfg.get("bad.dir", "bad")); setArchiveDir(cfg.get("archive.dir", "archive")); setResponseSuffix(cfg.get("response.suffix", null)); setShouldArchive(cfg.getBoolean("archive", false)); setShouldCompressArchive(cfg.getBoolean("archive.compress", false)); setAcceptZeroLength (cfg.getBoolean ("zero-length", false)); setArchiveDateFormat ( cfg.get ("archive.dateformat", "yyyyMMddHHmmss") ); setShouldTimestampArchive (cfg.getBoolean ("archive.timestamp", false)); setRegexPriorityMatching(cfg.getBoolean("priority.regex", false)); } } DirPoll(); synchronized void setPath(String base); void setShouldTimestampArchive(boolean shouldTimestampArchive); void setArchiveDateFormat(String dateFormat); void setShouldArchive(boolean shouldArchive); void setShouldCompressArchive(boolean shouldCompressArchive); void setAcceptZeroLength(boolean acceptZeroLength); String getPath(); void setRequestDir(String dir); void setResponseDir(String dir); void setTmpDir(String dir); void setBadDir(String dir); void setRunDir(String dir); void setArchiveDir(String dir); void setPollInterval(long pollInterval); void setResponseSuffix(String suffix); long getPollInterval(); void setProcessor(Object processor); boolean isRegexPriorityMatching(); void setRegexPriorityMatching(boolean regexPriorityMatching); Object getProcessor(); void setConfiguration(Configuration cfg); void setPriorities(String priorities); synchronized void setThreadPool(ThreadPool pool); boolean accept(File dir, String name); void run(); void destroy(); void createDirs(); void addPriority(String fileExtension); void pause(); void unpause(); boolean isPaused();  }### Answer:
@Test public void testSetConfigurationThrowsNullPointerException4() throws Throwable { Configuration cfg = new SubConfiguration(); DirPoll dirPoll = new DirPoll(); try { dirPoll.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()"); } } }