List<Element> elements = Elements.getElements(underTest);
for (Element element : elements) {
if (element instanceof InterceptorBinding) {
InterceptorBinding binding = (InterceptorBinding) element;
assertTrue(binding.getClassMatcher().matches(getClass()));
Method method = null;
Class<? extends Annotation> theAnnotation = null;
for (Class<? extends Annotation> annotation : protectedMethods.keySet()) {
if (binding.getMethodMatcher().matches(protectedMethods.get(annotation))) {
method = protectedMethods.get(annotation);
theAnnotation = annotation;
protectedMethods.remove(annotation);
break;
}
}
if (method == null) {
fail("Did not expect interceptor binding " + binding.getInterceptors());
}
List<MethodInterceptor> interceptors = binding.getInterceptors();
assertEquals(1, interceptors.size());
assertTrue(interceptors.get(0) instanceof AopAllianceMethodInterceptorAdapter);
assertTrue(interceptorTypes.get(theAnnotation).isInstance(((AopAllianceMethodInterceptorAdapter) interceptors.get(0)).shiroInterceptor));
}