T annotation = findAnnotation(interfaze, annotationClass); if (null != annotation) { return annotation; return findAnnotation(superClazz, annotationClass);
@Test public void availableAnnotationThroughInterface() { Rule ruleAnnotation = ReflectionUtils.findAnnotation(TestClass3.class, Rule.class); assertThat(ruleAnnotation, not(equalTo(null))); }
@Test public void unavailableAnnotation() { Rule ruleAnnotation = ReflectionUtils.findAnnotation(NoDefaultConstructorClass.class, Rule.class); assertThat(ruleAnnotation, equalTo(null)); } }
@Test public void availableAnnotation() { Rule ruleAnnotation = ReflectionUtils.findAnnotation(TestClass.class, Rule.class); assertThat(ruleAnnotation, not(equalTo(null))); }
@Test public void availableAnnotationThroughSuperclass() { Rule ruleAnnotation = ReflectionUtils.findAnnotation(TestClass2.class, Rule.class); assertThat(ruleAnnotation, not(equalTo(null))); }
Rule annotation = ReflectionUtils.findAnnotation(clazz, Rule.class); if (annotation == null) { throw new RuleDefinitionException(clazz.getName() + " must be annotated with @Rule annotation.");