Polishing

This commit is contained in:
Juergen Hoeller 2024-01-06 23:21:57 +01:00
parent 70247c4a94
commit d6c84c43ec
1 changed files with 4 additions and 6 deletions

View File

@ -412,8 +412,7 @@ class MergedAnnotationsTests {
MultiValueMap<String, Object> map = MergedAnnotations.from( MultiValueMap<String, Object> map = MergedAnnotations.from(
SubClassWithInheritedAnnotation.class, SearchStrategy.INHERITED_ANNOTATIONS) SubClassWithInheritedAnnotation.class, SearchStrategy.INHERITED_ANNOTATIONS)
.stream(Transactional.class).collect(MergedAnnotationCollectors.toMultiValueMap()); .stream(Transactional.class).collect(MergedAnnotationCollectors.toMultiValueMap());
assertThat(map).contains( assertThat(map).contains(entry("qualifier", List.of("composed2", "transactionManager")));
entry("qualifier", Arrays.asList("composed2", "transactionManager")));
} }
@Test @Test
@ -456,8 +455,7 @@ class MergedAnnotationsTests {
MultiValueMap<String, Object> map = MergedAnnotations.from( MultiValueMap<String, Object> map = MergedAnnotations.from(
TxFromMultipleComposedAnnotations.class, SearchStrategy.INHERITED_ANNOTATIONS) TxFromMultipleComposedAnnotations.class, SearchStrategy.INHERITED_ANNOTATIONS)
.stream(Transactional.class).collect(MergedAnnotationCollectors.toMultiValueMap()); .stream(Transactional.class).collect(MergedAnnotationCollectors.toMultiValueMap());
assertThat(map).contains( assertThat(map).contains(entry("value", List.of("TxInheritedComposed", "TxComposed")));
entry("value", Arrays.asList("TxInheritedComposed", "TxComposed")));
} }
@Test @Test
@ -656,7 +654,7 @@ class MergedAnnotationsTests {
@Test @Test
void getWithTypeHierarchyInheritedFromInterfaceMethod() throws Exception { void getWithTypeHierarchyInheritedFromInterfaceMethod() throws Exception {
Method method = ConcreteClassWithInheritedAnnotation.class.getMethod("handleFromInterface"); Method method = ConcreteClassWithInheritedAnnotation.class.getMethod("handleFromInterface");
MergedAnnotation<?> annotation = MergedAnnotations.from(method,SearchStrategy.TYPE_HIERARCHY).get(Order.class); MergedAnnotation<?> annotation = MergedAnnotations.from(method, SearchStrategy.TYPE_HIERARCHY).get(Order.class);
assertThat(annotation.isPresent()).isTrue(); assertThat(annotation.isPresent()).isTrue();
assertThat(annotation.getAggregateIndex()).isEqualTo(1); assertThat(annotation.getAggregateIndex()).isEqualTo(1);
} }
@ -1129,7 +1127,7 @@ class MergedAnnotationsTests {
@Test @Test
void getSuperClassSourceForTypesWithMultipleCandidateTypes() { void getSuperClassSourceForTypesWithMultipleCandidateTypes() {
List<Class<? extends Annotation>> candidates = Arrays.asList(Transactional.class, Order.class); List<Class<? extends Annotation>> candidates = List.of(Transactional.class, Order.class);
// no class-level annotation // no class-level annotation
assertThat(getSuperClassSourceWithTypeIn(NonAnnotatedInterface.class, assertThat(getSuperClassSourceWithTypeIn(NonAnnotatedInterface.class,
candidates)).isNull(); candidates)).isNull();