### Question:
IncludeDecoratorFilterImpl implements Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException { ValueMap parameters = ValueMap.EMPTY; if(servletRequest instanceof SlingHttpServletRequest){ SlingHttpServletRequest request = (SlingHttpServletRequest) servletRequest; if(request.getResourceResolver().isResourceType(request.getResource(), RESOURCE_TYPE)){ performFilter(request, servletResponse, chain, parameters); return; } } chain.doFilter(servletRequest, servletResponse); }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain); @Override void destroy();  }### Answer:
@Test public void test() throws IOException, ServletException { Mockito.doAnswer(invocationOnMock -> { SlingHttpServletRequest captured = invocationOnMock.getArgument(0, SlingHttpServletRequest.class); assertEquals("block1", captured.getAttribute(REQ_ATTR_NAMESPACE)); return null; }).when(filterChain).doFilter(any(SlingHttpServletRequest.class), any(SlingHttpServletResponse.class)); systemUnderTest.doFilter(context.request(), context.response(), filterChain); assertTrue("namespace is removed after the filter is performed", context.request().getAttribute(REQ_ATTR_NAMESPACE) == null); }
@Test public void test_nested_include() throws IOException, ServletException { Mockito.doAnswer(invocationOnMock -> { SlingHttpServletRequest captured = invocationOnMock.getArgument(0, SlingHttpServletRequest.class); assertEquals("nested/block1", captured.getAttribute(REQ_ATTR_NAMESPACE)); return null; }).when(filterChain).doFilter(any(SlingHttpServletRequest.class), any(SlingHttpServletResponse.class)); context.request().setAttribute(REQ_ATTR_NAMESPACE, "nested"); systemUnderTest.doFilter(context.request(), context.response(), filterChain); assertEquals("nested", context.request().getAttribute(REQ_ATTR_NAMESPACE)); }