@@ -679,12 +679,9 @@ void getWithTypeHierarchyFromSubSubNonInheritedAnnotationInterface() {
679
679
}
680
680
681
681
@ Test
682
- void getWithTypeHierarchyInheritedFromInterfaceMethod ()
683
- throws NoSuchMethodException {
684
- Method method = ConcreteClassWithInheritedAnnotation .class .getMethod (
685
- "handleFromInterface" );
686
- MergedAnnotation <?> annotation = MergedAnnotations .from (method ,
687
- SearchStrategy .TYPE_HIERARCHY ).get (Order .class );
682
+ void getWithTypeHierarchyInheritedFromInterfaceMethod () throws Exception {
683
+ Method method = ConcreteClassWithInheritedAnnotation .class .getMethod ("handleFromInterface" );
684
+ MergedAnnotation <?> annotation = MergedAnnotations .from (method ,SearchStrategy .TYPE_HIERARCHY ).get (Order .class );
688
685
assertThat (annotation .isPresent ()).isTrue ();
689
686
assertThat (annotation .getAggregateIndex ()).isEqualTo (1 );
690
687
}
@@ -1384,7 +1381,7 @@ void getDefaultValueFromAnnotationType() {
1384
1381
}
1385
1382
1386
1383
@ Test
1387
- void getRepeatableDeclaredOnMethod () throws Exception {
1384
+ void streamRepeatableDeclaredOnMethod () throws Exception {
1388
1385
Method method = InterfaceWithRepeated .class .getMethod ("foo" );
1389
1386
Stream <MergedAnnotation <MyRepeatable >> annotations = MergedAnnotations .from (
1390
1387
method , SearchStrategy .TYPE_HIERARCHY ).stream (MyRepeatable .class );
@@ -1395,7 +1392,7 @@ void getRepeatableDeclaredOnMethod() throws Exception {
1395
1392
1396
1393
@ Test
1397
1394
@ SuppressWarnings ("deprecation" )
1398
- void getRepeatableDeclaredOnClassWithAttributeAliases () {
1395
+ void streamRepeatableDeclaredOnClassWithAttributeAliases () {
1399
1396
assertThat (MergedAnnotations .from (HierarchyClass .class ).stream (
1400
1397
TestConfiguration .class )).isEmpty ();
1401
1398
RepeatableContainers containers = RepeatableContainers .of (TestConfiguration .class ,
@@ -1409,47 +1406,47 @@ void getRepeatableDeclaredOnClassWithAttributeAliases() {
1409
1406
}
1410
1407
1411
1408
@ Test
1412
- void getRepeatableDeclaredOnClass () {
1409
+ void streamRepeatableDeclaredOnClass () {
1413
1410
Class <?> element = MyRepeatableClass .class ;
1414
1411
String [] expectedValuesJava = { "A" , "B" , "C" };
1415
1412
String [] expectedValuesSpring = { "A" , "B" , "C" , "meta1" };
1416
1413
testRepeatables (SearchStrategy .SUPERCLASS , element , expectedValuesJava , expectedValuesSpring );
1417
1414
}
1418
1415
1419
1416
@ Test
1420
- void getRepeatableDeclaredOnSuperclass () {
1417
+ void streamRepeatableDeclaredOnSuperclass () {
1421
1418
Class <?> element = SubMyRepeatableClass .class ;
1422
1419
String [] expectedValuesJava = { "A" , "B" , "C" };
1423
1420
String [] expectedValuesSpring = { "A" , "B" , "C" , "meta1" };
1424
1421
testRepeatables (SearchStrategy .SUPERCLASS , element , expectedValuesJava , expectedValuesSpring );
1425
1422
}
1426
1423
1427
1424
@ Test
1428
- void getRepeatableDeclaredOnClassAndSuperclass () {
1425
+ void streamRepeatableDeclaredOnClassAndSuperclass () {
1429
1426
Class <?> element = SubMyRepeatableWithAdditionalLocalDeclarationsClass .class ;
1430
1427
String [] expectedValuesJava = { "X" , "Y" , "Z" };
1431
1428
String [] expectedValuesSpring = { "X" , "Y" , "Z" , "meta2" };
1432
1429
testRepeatables (SearchStrategy .SUPERCLASS , element , expectedValuesJava , expectedValuesSpring );
1433
1430
}
1434
1431
1435
1432
@ Test
1436
- void getRepeatableDeclaredOnMultipleSuperclasses () {
1433
+ void streamRepeatableDeclaredOnMultipleSuperclasses () {
1437
1434
Class <?> element = SubSubMyRepeatableWithAdditionalLocalDeclarationsClass .class ;
1438
1435
String [] expectedValuesJava = { "X" , "Y" , "Z" };
1439
1436
String [] expectedValuesSpring = { "X" , "Y" , "Z" , "meta2" };
1440
1437
testRepeatables (SearchStrategy .SUPERCLASS , element , expectedValuesJava , expectedValuesSpring );
1441
1438
}
1442
1439
1443
1440
@ Test
1444
- void getDirectRepeatablesDeclaredOnClass () {
1441
+ void streamDirectRepeatablesDeclaredOnClass () {
1445
1442
Class <?> element = MyRepeatableClass .class ;
1446
1443
String [] expectedValuesJava = { "A" , "B" , "C" };
1447
1444
String [] expectedValuesSpring = { "A" , "B" , "C" , "meta1" };
1448
1445
testRepeatables (SearchStrategy .DIRECT , element , expectedValuesJava , expectedValuesSpring );
1449
1446
}
1450
1447
1451
1448
@ Test
1452
- void getDirectRepeatablesDeclaredOnSuperclass () {
1449
+ void streamDirectRepeatablesDeclaredOnSuperclass () {
1453
1450
Class <?> element = SubMyRepeatableClass .class ;
1454
1451
String [] expectedValuesJava = {};
1455
1452
String [] expectedValuesSpring = {};
@@ -1476,20 +1473,17 @@ private void testExplicitRepeatables(SearchStrategy searchStrategy, Class<?> ele
1476
1473
MergedAnnotations annotations = MergedAnnotations .from (element , searchStrategy ,
1477
1474
RepeatableContainers .of (MyRepeatable .class , MyRepeatableContainer .class ),
1478
1475
AnnotationFilter .PLAIN );
1479
- assertThat (annotations .stream (MyRepeatable .class ).filter (
1480
- MergedAnnotationPredicates .firstRunOf (
1481
- MergedAnnotation ::getAggregateIndex )).map (
1482
- annotation -> annotation .getString (
1483
- "value" ))).containsExactly (expected );
1476
+ Stream <String > values = annotations .stream (MyRepeatable .class )
1477
+ .filter (MergedAnnotationPredicates .firstRunOf (MergedAnnotation ::getAggregateIndex ))
1478
+ .map (annotation -> annotation .getString ("value" ));
1479
+ assertThat (values ).containsExactly (expected );
1484
1480
}
1485
1481
1486
1482
private void testStandardRepeatables (SearchStrategy searchStrategy , Class <?> element , String [] expected ) {
1487
- MergedAnnotations annotations = MergedAnnotations .from (element , searchStrategy );
1488
- assertThat (annotations .stream (MyRepeatable .class ).filter (
1489
- MergedAnnotationPredicates .firstRunOf (
1490
- MergedAnnotation ::getAggregateIndex )).map (
1491
- annotation -> annotation .getString (
1492
- "value" ))).containsExactly (expected );
1483
+ Stream <String > values = MergedAnnotations .from (element , searchStrategy ).stream (MyRepeatable .class )
1484
+ .filter (MergedAnnotationPredicates .firstRunOf (MergedAnnotation ::getAggregateIndex ))
1485
+ .map (annotation -> annotation .getString ("value" ));
1486
+ assertThat (values ).containsExactly (expected );
1493
1487
}
1494
1488
1495
1489
@ Test
0 commit comments