ResourceInitializer implements ServletContextListener { @Override public void contextDestroyed(ServletContextEvent sce) { try { clusterSvc.destroy(); VcContext.endSession(); } catch (Throwable t) { logger.error("Resource destroy failed.", t); } }  @Override void contextInitialized(ServletContextEvent sce); @Override void contextDestroyed(ServletContextEvent sce);  }
@Test public void testContextDestroyed() { resourceInitializer.contextDestroyed(sce); verify(clusteringService).destroy(); assertTrue(endSessionFlag); }