assertTrue(filters.get(1) instanceof UsernamePasswordAuthenticationFilter);
assertTrue(filters.get(2) instanceof MockFilter);
}
private void doNormalOperation(FilterChainProxy filterChainProxy) throws Exception {
MockFilter filter = (MockFilter) applicationContext.getBean("mockFilter", MockFilter.class);
assertFalse(filter.isInitialized());
assertFalse(filter.isDoFiltered());
assertFalse(filter.isDestroyed());
filter.init(new MockFilterConfig());
assertTrue(filter.isInitialized());
assertFalse(filter.isDoFiltered());
assertFalse(filter.isDestroyed());
MockHttpServletRequest request = new MockHttpServletRequest();
request.setServletPath("/foo/secure/super/somefile.html");
request.setContextPath("/");
MockHttpServletResponse response = new MockHttpServletResponse();
filterChainProxy.doFilter(request, response, new MockFilterChain());
assertTrue(filter.isInitialized());
assertTrue(filter.isDoFiltered());
assertFalse(filter.isDestroyed());
request.setServletPath("/a/path/which/doesnt/match/any/filter.html");
filterChainProxy.doFilter(request, response, new MockFilterChain());
filter.destroy();
assertTrue(filter.isInitialized());
assertTrue(filter.isDoFiltered());
assertTrue(filter.isDestroyed());
}