### Question:
WroFilter implements Filter { public final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain) throws IOException, ServletException { final HttpServletRequest request = (HttpServletRequest) req; final HttpServletResponse response = (HttpServletResponse) res; if (isFilterActive(request)) { LOG.debug("processing wro request: {}", request.getRequestURI()); try { Context.set(Context.webContext(request, response, filterConfig), wroConfiguration); addPassThroughFilterAttribute(request); if (!handledWithRequestHandler(request, response)) { processRequest(request, response); onRequestProcessed(); } } catch (final Exception e) { onException(e, response, chain); } finally { Context.unset(); } } else { chain.doFilter(request, response); } }  static boolean isPassedThroughyWroFilter(final HttpServletRequest request); final void init(final FilterConfig config); final void doFilter(final ServletRequest req, final ServletResponse res, final FilterChain chain); void setWroManagerFactory(final WroManagerFactory wroManagerFactory); final WroManagerFactory getWroManagerFactory(); void setRequestHandlerFactory(final RequestHandlerFactory requestHandlerFactory); void setWroConfigurationFactory(final ObjectFactory<WroConfiguration> wroConfigurationFactory); final WroConfiguration getConfiguration(); final void setConfiguration(final WroConfiguration config); void setEnable(final boolean enable); void destroy(); static final String ATTRIBUTE_PASSED_THROUGH_FILTER; }### Answer:
@Test public void testApiCallInDEPLOYMENTMode() throws Exception { initChainOnErrorFilter(); when(mockRequest.getRequestURI()).thenReturn(ReloadCacheRequestHandler.PATH_API + "/someMethod"); setConfigurationMode(FilterConfigWroConfigurationFactory.PARAM_VALUE_DEPLOYMENT); victim.doFilter(mockRequest, mockResponse, mockFilterChain); verifyChainIsCalled(mockFilterChain); }
@Test public void testApiCallInDEVELOPMENTModeAndInvalidApiCall() throws Exception { initChainOnErrorFilter(); when(mockRequest.getRequestURI()).thenReturn(ReloadCacheRequestHandler.PATH_API + "/someMethod"); victim.doFilter(mockRequest, mockResponse, mockFilterChain); verifyChainIsCalled(mockFilterChain); }
@Test public void shouldChainTheIncludedRequestByDispatcher() throws Exception { when(mockRequest.getAttribute(DispatcherStreamLocator.ATTRIBUTE_INCLUDED_BY_DISPATCHER)).thenReturn(Boolean.TRUE); victim.doFilter(mockRequest, mockResponse, mockFilterChain); verify(mockManagerFactory, Mockito.never()).create(); verifyChainIsCalled(mockFilterChain); }