### Question:
CustomFilterAdapter implements Filter, CustomFilterAdapterListener { @Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { List<Filter> localFilterChain = injectedFilterChain; if (!localFilterChain.isEmpty()) { AAAFilterChain.createAAAFilterChain().doFilter(request, response, chain, localFilterChain); } else { chain.doFilter(request, response); } } CustomFilterAdapter(CustomFilterAdapterConfiguration customFilterAdapterConfig); @Override void destroy(); @Override void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain); @Override void init(final FilterConfig newFilterConfig); @Override void updateInjectedFilters(final List<Filter> injectedFilters); @Override FilterConfig getFilterConfig();  }### Answer:
@Test public void testDoFilter() throws Exception { final CustomFilterAdapter customFilterAdapter = new CustomFilterAdapter(mockAdapterConfig); final FilterChainMockUtils.TestFilterDTO testFilterDTO = FilterChainMockUtils.createFilterChain(3); customFilterAdapter.updateInjectedFilters(testFilterDTO.getFilters()); final boolean[] existingFilterChainEncountered = { false }; doAnswer(invocationOnMock -> { existingFilterChainEncountered[0] = true; return null; }).when(filterChain).doFilter(any(), any()); customFilterAdapter.doFilter(servletRequest, servletResponse, filterChain); assertTrue(existingFilterChainEncountered[0]); customFilterAdapter.destroy(); }