WroManager implements WroConfigurationChangeListener { public final void destroy() { try { cacheSchedulerHelper.destroy(); modelSchedulerHelper.destroy(); cacheStrategy.destroy(); modelFactory.destroy(); resourceWatcher.destroy(); destroyProcessors(); } catch (final Exception e) { LOG.error("Exception occured during manager destroy!", e); } finally { LOG.debug("WroManager destroyed"); } } private  WroManager(final Builder builder); final void process(); final String encodeVersionIntoGroupPath(final String groupName, final ResourceType resourceType,
      final boolean minimize); @Override final void onCachePeriodChanged(final long period); @Override final void onModelPeriodChanged(final long period); final void destroy(); final HashStrategy getHashStrategy(); final WroModelFactory getModelFactory(); final ProcessorsFactory getProcessorsFactory(); final CacheStrategy<CacheKey, CacheValue> getCacheStrategy(); final UriLocatorFactory getUriLocatorFactory(); final NamingStrategy getNamingStrategy(); final GroupExtractor getGroupExtractor(); CacheKeyFactory getCacheKeyFactory(); MetaDataFactory getMetaDataFactory(); ResourceWatcher getResourceWatcher(); final void registerCallback(final ObjectFactory<LifecycleCallback> callbackFactory); LifecycleCallbackRegistry getCallbackRegistry(); ResourceAuthorizationManager getResourceAuthorizationManager();  }
@Test public void shouldDestroyDependenciesWhenDestoryed() { final WroManager manager = new WroManager.Builder().setCacheStrategy(mockCacheStrategy).setModelFactory( mockModelFactory).build(); manager.destroy(); verify(mockCacheStrategy).destroy(); verify(mockModelFactory).destroy(); }
@Test public void shouldDestroyDestroyableProcessorWhenManagerIsDestroyed() { final DestroyableProcessor preProcessor = Mockito.mock(DestroyableProcessor.class); final DestroyableProcessor postProcessor = Mockito.mock(DestroyableProcessor.class); victim = new BaseWroManagerFactory().setProcessorsFactory( new SimpleProcessorsFactory().addPreProcessor(preProcessor).addPostProcessor(postProcessor)).create(); victim.destroy(); Mockito.verify(preProcessor, Mockito.times(1)).destroy(); Mockito.verify(postProcessor, Mockito.times(1)).destroy(); }