### Question:
DirPollAdaptor extends QBeanSupport implements DirPollAdaptorMBean { protected void stopService () throws Exception { dirPoll.destroy (); synchronized (dirPoll) { if (dirPollThread != null) { long shutdownTimeout = cfg.getLong("shutdown-timeout", 60000); try { dirPollThread.join(shutdownTimeout); } catch (InterruptedException e) { } if (dirPollThread.isAlive()) { getLog().warn(getName() + " - dirPoll thread did not finish in " + shutdownTimeout + " milliseconds. Interrupting thread now."); dirPollThread.interrupt(); } dirPollThread = null; } } } DirPollAdaptor(); synchronized void setPath(String path); synchronized void setPoolSize(int size); int getPoolSize(); String getPath(); synchronized void setPollInterval(long pollInterval); long getPollInterval(); synchronized void setPriorities(String priorities); String getPriorities(); synchronized void setProcessor(String processor); String getProcessor();  }### Answer:
@Test public void testStopServiceThrowsNullPointerException() throws Throwable { DirPollAdaptor dirPollAdaptor = new DirPollAdaptor(); try { dirPollAdaptor.stopService(); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { if (isJavaVersionAtMost(JAVA_14)) { assertNull(ex.getMessage(), "ex.getMessage()"); } else { assertEquals("Cannot invoke \"org.jpos.util.DirPoll.destroy()\" because \"this.dirPoll\" is null", ex.getMessage(), "ex.getMessage()"); } assertNull(dirPollAdaptor.dirPoll, "dirPollAdaptor.dirPoll"); } }