CandlepinContextListener extends GuiceResteasyBootstrapServletContextListener { @Override public void contextDestroyed(ServletContextEvent event) { super.contextDestroyed(event); try { this.destroySubsystems(); } catch (Exception e) { throw new RuntimeException(e); } }  @Override void contextInitialized(ServletContextEvent sce); @Override void withInjector(Injector injector); @Override void contextDestroyed(ServletContextEvent event); static final String CONFIGURATION_NAME; }
@Test public void contextDestroyed() { Enumeration<Driver> drivers = DriverManager.getDrivers(); when(config.getBoolean(eq(ConfigProperties.ACTIVEMQ_ENABLED))).thenReturn(true); prepareForInitialization(); listener.contextInitialized(evt); listener.contextDestroyed(evt); verify(evt, atMost(5)).getServletContext(); verifyNoMoreInteractions(evt); verify(hqlistener).contextDestroyed(any(Injector.class)); verifyZeroInteractions(buspublisher); registerDrivers(drivers); }