SecureInterceptor { OcelotSecured getOcelotSecuredAnnotation(Method method) { if (method.isAnnotationPresent(OcelotSecured.class)) { return method.getAnnotation(OcelotSecured.class); } else { return method.getDeclaringClass().getAnnotation(OcelotSecured.class); } }  @AroundInvoke Object processSecure(InvocationContext ctx);  }
@Test public void testGetOcelotSecuredAnnotation() throws Exception { System.out.println("getOcelotSecuredAnnotation"); Method method = AnnotedClass.class.getDeclaredMethod("methodNoAnnoted"); OcelotSecured result = instance.getOcelotSecuredAnnotation(method); assertThat(result.roles()).containsExactly("ROLE_ON_CLASS"); method = AnnotedClass.class.getDeclaredMethod("methodAnnoted"); result = instance.getOcelotSecuredAnnotation(method); assertThat(result.roles()).containsExactly("ROLE_ON_METHOD"); }