AmbariDelegatingAuthenticationFilter implements Filter { @Override public void init(FilterConfig filterConfig) throws ServletException { for (AmbariAuthenticationFilter filter : filters) { filter.init(filterConfig); } } AmbariDelegatingAuthenticationFilter(Collection<AmbariAuthenticationFilter> filters); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain); @Override void destroy();  }
@Test public void testInit() throws Exception { FilterConfig filterConfig = createMock(FilterConfig.class); AmbariAuthenticationFilter filter1 = createMock(AmbariAuthenticationFilter.class); filter1.init(filterConfig); expectLastCall().once(); AmbariAuthenticationFilter filter2 = createMock(AmbariAuthenticationFilter.class); filter2.init(filterConfig); expectLastCall().once(); AmbariAuthenticationFilter filter3 = createMock(AmbariAuthenticationFilter.class); filter3.init(filterConfig); expectLastCall().once(); replayAll(); Filter filter = new AmbariDelegatingAuthenticationFilter(Arrays.asList(filter1, filter2, filter3)); filter.init(filterConfig); verifyAll(); }