From f8b875d2d8a6ad4462a8b28cbeae4e40e400c087 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Thu, 24 Oct 2019 16:15:59 +0200 Subject: [PATCH] Introduce failing @Disabled test for gh-23856 --- .../core/annotation/AnnotationUtilsTests.java | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java index 0a0a4f0939..f74a0693a0 100644 --- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java +++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java @@ -34,6 +34,7 @@ import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.springframework.core.Ordered; @@ -964,6 +965,25 @@ class AnnotationUtilsTests { TestRepeatableContainer.class)).isNotNull(); } + @Test // gh-23856 + void findAnnotationFindsRepeatableContainerOnComposedAnnotationMetaAnnotatedWithRepeatableAnnotations() { + MyRepeatableContainer annotation = AnnotationUtils.findAnnotation(MyRepeatableMeta1And2.class, MyRepeatableContainer.class); + + assertThat(annotation).isNotNull(); + assertThat(annotation.value()).extracting(MyRepeatable::value).containsExactly("meta1", "meta2"); + } + + @Test // gh-23856 + @Disabled("disabled until gh-23856 is resolved") + void findAnnotationFindsRepeatableContainerOnComposedAnnotationMetaAnnotatedWithRepeatableAnnotationsOnMethod() throws NoSuchMethodException { + Method method = getClass().getDeclaredMethod("methodWithComposedAnnotationMetaAnnotatedWithRepeatableAnnotations"); + MyRepeatableContainer annotation = AnnotationUtils.findAnnotation(method, MyRepeatableContainer.class); + + assertThat(annotation).isNotNull(); + assertThat(annotation.value()).extracting(MyRepeatable::value).containsExactly("meta1", "meta2"); + } + + @SafeVarargs static T[] asArray(T... arr) { return arr; @@ -1262,6 +1282,17 @@ class AnnotationUtilsTests { @interface MyRepeatableMeta2 { } + @Retention(RetentionPolicy.RUNTIME) + @Inherited + @MyRepeatable("meta1") + @MyRepeatable("meta2") + @interface MyRepeatableMeta1And2 { + } + + @MyRepeatableMeta1And2 + void methodWithComposedAnnotationMetaAnnotatedWithRepeatableAnnotations() { + } + interface InterfaceWithRepeated { @MyRepeatable("A")