Ejemplo n.º 1
0
  @Test
  public void shouldNotDestroyWroModelWhenCacheIsNotDisabled() throws Exception {
    final WroConfiguration config = new WroConfiguration();
    config.setDisableCache(false);

    when(mockRequest.getRequestURI()).thenReturn("/resource/g1.css");
    Context.set(Context.webContext(mockRequest, mockResponse, mockFilterConfig));
    victim.setConfiguration(config);
    victim.setWroManagerFactory(createValidManagerFactory());
    victim.init(mockFilterConfig);

    final WroManager manager = victim.getWroManagerFactory().create();
    final WroModelFactory proxyModelFactory = Mockito.spy(manager.getModelFactory());
    // configure spied proxy for mocking
    manager.setModelFactory(proxyModelFactory);

    victim.doFilter(mockRequest, mockResponse, mockFilterChain);

    verify(proxyModelFactory, Mockito.never()).destroy();
  }