}
@Test
public void testAuthorizationPolicy() {
SpringSecurityAuthorizationPolicy adminPolicy = context.getBean("admin", SpringSecurityAuthorizationPolicy.class);
assertNotNull("We should get admin policy", adminPolicy);
assertNotNull("The accessDecisionManager should not be null", adminPolicy.getAccessDecisionManager());
assertNotNull("The authenticationManager should not be null", adminPolicy.getAuthenticationManager());
assertNotNull("The springSecurityAccessPolicy should not be null", adminPolicy.getSpringSecurityAccessPolicy());
SpringSecurityAuthorizationPolicy userPolicy = context.getBean("user", SpringSecurityAuthorizationPolicy.class);
assertNotNull("We should get user policy", userPolicy);
assertNotNull("The accessDecisionManager should not be null", userPolicy.getAccessDecisionManager());
assertNotNull("The authenticationManager should not be null", userPolicy.getAuthenticationManager());
assertNotNull("The springSecurityAccessPolicy should not be null", userPolicy.getSpringSecurityAccessPolicy());
assertEquals("user policy and admin policy should have same accessDecisionManager", adminPolicy.getAccessDecisionManager(), userPolicy.getAccessDecisionManager());
assertEquals("user policy and admin policy should have same authenticationManager", adminPolicy.getAuthenticationManager(), userPolicy.getAuthenticationManager());
}