Application { public void shutdown() { for (ShutdownListener listener : shutdownListeners) { listener.shutdown(); } } Application(Router router);  Application(Router router, Reporter reporter); Agent[] getAgents(); void addRequestFilter(RequestFilter filter); void addResponseFilter(ResponseFilter filter); void addShutdownListener(ShutdownListener listener); void setUser(User user); Response process(Request request); void shutdown();  }
@Test public void testShutdown() { Router router = mock(Router.class); Application app = new Application(router); ShutdownListener listener = mock(ShutdownListener.class); app.addShutdownListener(listener); app.shutdown(); verify(listener, times(1)).shutdown(); }