@@ -64,6 +64,20 @@ void findMergedRepeatableAnnotations_AnnotatedElementUtils() {
64
64
assertThat (annotations ).extracting (A ::value ).containsExactly (5 );
65
65
}
66
66
67
+ @ Test
68
+ void getMergedRepeatableAnnotationsWithStandardRepeatables_AnnotatedElementUtils () {
69
+ Set <A > annotations = AnnotatedElementUtils .getMergedRepeatableAnnotations (method , A .class );
70
+ // Merged, so we expect to find @A once with its value coming from @B(5).
71
+ assertThat (annotations ).extracting (A ::value ).containsExactly (5 );
72
+ }
73
+
74
+ @ Test
75
+ void getMergedRepeatableAnnotationsWithExplicitContainer_AnnotatedElementUtils () {
76
+ Set <A > annotations = AnnotatedElementUtils .getMergedRepeatableAnnotations (method , A .class , A .Container .class );
77
+ // Merged, so we expect to find @A once with its value coming from @B(5).
78
+ assertThat (annotations ).extracting (A ::value ).containsExactly (5 );
79
+ }
80
+
67
81
@ Test
68
82
@ SuppressWarnings ("deprecation" )
69
83
void getRepeatableAnnotations_AnnotationUtils () {
@@ -107,7 +121,6 @@ void streamRepeatableAnnotationsWithExplicitRepeatables_MergedAnnotationsApi() {
107
121
void findMergedRepeatableAnnotationsWithStandardRepeatables_AnnotatedElementUtils () {
108
122
Set <A > annotations = AnnotatedElementUtils .findMergedRepeatableAnnotations (method , A .class );
109
123
// Merged, so we expect to find @A twice with values coming from @B(5) and @B(10).
110
- // However, findMergedRepeatableAnnotations() currently finds ZERO annotations.
111
124
assertThat (annotations ).extracting (A ::value ).containsExactly (5 , 10 );
112
125
}
113
126
@@ -126,6 +139,28 @@ void findMergedRepeatableAnnotationsWithExplicitContainer_AnnotatedElementUtils(
126
139
assertThat (annotations ).isEmpty ();
127
140
}
128
141
142
+ @ Test
143
+ void getMergedRepeatableAnnotationsWithStandardRepeatables_AnnotatedElementUtils () {
144
+ Set <A > annotations = AnnotatedElementUtils .getMergedRepeatableAnnotations (method , A .class );
145
+ // Merged, so we expect to find @A twice with values coming from @B(5) and @B(10).
146
+ assertThat (annotations ).extracting (A ::value ).containsExactly (5 , 10 );
147
+ }
148
+
149
+ @ Test
150
+ void getMergedRepeatableAnnotationsWithExplicitContainer_AnnotatedElementUtils () {
151
+ Set <A > annotations = AnnotatedElementUtils .getMergedRepeatableAnnotations (method , A .class , A .Container .class );
152
+ // When getMergedRepeatableAnnotations(...) is invoked with an explicit container
153
+ // type, it uses RepeatableContainers.of(...) which limits the repeatable annotation
154
+ // support to a single container type.
155
+ //
156
+ // In this test case, we are therefore limiting the support to @A.Container, which
157
+ // means that @B.Container is unsupported and effectively ignored as a repeatable
158
+ // container type.
159
+ //
160
+ // Long story, short: the search doesn't find anything.
161
+ assertThat (annotations ).isEmpty ();
162
+ }
163
+
129
164
@ Test
130
165
@ SuppressWarnings ("deprecation" )
131
166
void getRepeatableAnnotations_AnnotationUtils () {
0 commit comments