### Question:
Ackd implements SpringServiceDaemon, DisposableBean { protected void restartReaders(boolean reloadConfigs) { log().info("restartReaders: restarting readers..."); stopReaders(); startReaders(reloadConfigs); log().info("restartReaders: readers restarted."); }  void start(); void destroy(); @EventHandler(uei=EventConstants.ACKNOWLEDGE_EVENT_UEI) void handleAckEvent(Event event); @EventHandler(uei=EventConstants.RELOAD_DAEMON_CONFIG_UEI) void handleReloadConfigEvent(Event event); void setExecutor(ScheduledThreadPoolExecutor executor); ScheduledThreadPoolExecutor getExecutor(); EventForwarder getEventForwarder(); void setEventForwarder(EventForwarder eventForwarder); void setAckReaders(List<AckReader> ackReaders); AckService getAckService(); void setAckService(AckService ackService); AckdConfigurationDao getConfigDao(); void setConfigDao(AckdConfigurationDao config); @Override void afterPropertiesSet(); String getName(); static final String NAME; }### Answer:
@Test public void testRestartReaders() throws Exception { AckReader reader = m_daemon.getAckReaders().get(0); Reader readerConfig = m_daemon.getConfigDao().getReader("JavaMailReader"); readerConfig.setEnabled(true); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.STOPPED.equals(reader.getState())); m_daemon.restartReaders(false); Thread.sleep(30); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.STARTED.equals(reader.getState())); m_daemon.pauseReaders(); Thread.sleep(30); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.PAUSED.equals(reader.getState())); m_daemon.resumeReaders(); Thread.sleep(30); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.RESUMED.equals(reader.getState())); readerConfig.setEnabled(false); m_daemon.restartReaders(true); Thread.sleep(300); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.STOPPED.equals(reader.getState())); m_daemon.resumeReaders(); Thread.sleep(30); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.STOPPED.equals(reader.getState())); readerConfig.setEnabled(true); m_daemon.startReaders(); Thread.sleep(300); Assert.assertTrue("Unexpected reader state: "+reader.getState(), AckReaderState.STARTED.equals(reader.getState())); m_daemon.destroy(); }