PentahoCacheContextListener implements ServletContextListener { public void contextDestroyed( final ServletContextEvent event ) { ICacheManager cacheManager = PentahoSystem.getCacheManager( null ); if ( cacheManager != null ) { cacheManager.cacheStop(); } }  void contextInitialized( final ServletContextEvent event ); void contextDestroyed( final ServletContextEvent event );  }
@Test public void testContextDestroyed() throws Exception { PentahoSystem.registerObject( cacheManager ); pentahoCacheContextListener.contextDestroyed( contextEvent ); verify( cacheManager ).cacheStop(); }
@Test public void testContextDestroyed_noCachManager() throws Exception { pentahoCacheContextListener.contextDestroyed( contextEvent ); verify( cacheManager, never() ).cacheStop(); }