@@ -504,6 +504,15 @@ public void getRepeatableFromMethod() throws Exception {
504
504
assertThat (values , equalTo (Arrays .asList ("a" , "b" , "c" , "meta" )));
505
505
}
506
506
507
+ @ Test
508
+ public void getRepeatableWithMissingAttributeAliasDeclaration () throws Exception {
509
+ exception .expect (AnnotationConfigurationException .class );
510
+ exception .expectMessage (containsString ("Attribute [value] in" ));
511
+ exception .expectMessage (containsString (BrokenContextConfig .class .getName ()));
512
+ exception .expectMessage (containsString ("must be declared as an @AliasFor [locations]" ));
513
+ getRepeatableAnnotation (BrokenConfigHierarchyTestCase .class , BrokenHierarchy .class , BrokenContextConfig .class );
514
+ }
515
+
507
516
@ Test
508
517
public void getRepeatableWithAttributeAliases () throws Exception {
509
518
Set <ContextConfig > annotations = getRepeatableAnnotation (ConfigHierarchyTestCase .class , Hierarchy .class ,
@@ -1261,19 +1270,38 @@ public void handleMappedWithDifferentPathAndValueAttributes() {
1261
1270
String locations () default "" ;
1262
1271
}
1263
1272
1273
+ @ Retention (RetentionPolicy .RUNTIME )
1274
+ @interface BrokenContextConfig {
1275
+
1276
+ // Intentionally missing:
1277
+ // @AliasFor(attribute = "locations")
1278
+ String value () default "" ;
1279
+
1280
+ @ AliasFor (attribute = "value" )
1281
+ String locations () default "" ;
1282
+ }
1283
+
1264
1284
/**
1265
1285
* Mock of {@code org.springframework.test.context.ContextHierarchy}.
1266
1286
*/
1267
1287
@ Retention (RetentionPolicy .RUNTIME )
1268
1288
@interface Hierarchy {
1269
-
1270
1289
ContextConfig [] value ();
1271
1290
}
1272
1291
1292
+ @ Retention (RetentionPolicy .RUNTIME )
1293
+ @interface BrokenHierarchy {
1294
+ BrokenContextConfig [] value ();
1295
+ }
1296
+
1273
1297
@ Hierarchy ({ @ ContextConfig ("A" ), @ ContextConfig (locations = "B" ) })
1274
1298
static class ConfigHierarchyTestCase {
1275
1299
}
1276
1300
1301
+ @ BrokenHierarchy (@ BrokenContextConfig )
1302
+ static class BrokenConfigHierarchyTestCase {
1303
+ }
1304
+
1277
1305
@ ContextConfig ("simple.xml" )
1278
1306
static class SimpleConfigTestCase {
1279
1307
}
0 commit comments