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