Introduce getAnnotation() in AnnotatedElementUtils
This commit introduces a "synthesized annotation" alternative to getAnnotationAttributes() in AnnotatedElementUtils, analogous to the recently introduced findAnnotation() methods. Issue: SPR-13082
This commit is contained in:
@@ -322,6 +322,19 @@ public class AnnotatedElementUtilsTests {
|
||||
assertTrue(isAnnotated(element, name));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAnnotationWithAliasedValueComposedAnnotation() {
|
||||
Class<?> element = AliasedValueComposedContextConfigClass.class;
|
||||
ContextConfig contextConfig = getAnnotation(element, ContextConfig.class);
|
||||
|
||||
assertNotNull("Should find @ContextConfig on " + element.getSimpleName(), contextConfig);
|
||||
assertArrayEquals("locations", new String[] { "test.xml" }, contextConfig.locations());
|
||||
assertArrayEquals("value", new String[] { "test.xml" }, contextConfig.value());
|
||||
|
||||
// Verify contracts between utility methods:
|
||||
assertTrue(isAnnotated(element, ContextConfig.class.getName()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAnnotationAttributesWithInvalidConventionBasedComposedAnnotation() {
|
||||
Class<?> element = InvalidConventionBasedComposedContextConfigClass.class;
|
||||
|
||||
Reference in New Issue
Block a user