public void testAuthenticationManager() {
GenericXmlApplicationContext context = new GenericXmlApplicationContext(
getClass(), "resource-server-authmanager-context.xml");
// System.err.println(Arrays.asList(context.getBeanDefinitionNames()));
assertTrue(context.containsBeanDefinition("oauth2ProviderFilter"));
OAuth2AuthenticationProcessingFilter filter = context.getBean(OAuth2AuthenticationProcessingFilter.class);
assertEquals(context.getBean(AuthenticationManager.class), ReflectionTestUtils.getField(filter, "authenticationManager"));
assertNotNull(ReflectionTestUtils.getField(filter, "tokenExtractor"));
context.close();
}