|
36 | 36 | import org.junit.internal.ArrayComparisonFailure;
|
37 | 37 | import org.junit.rules.ExpectedException;
|
38 | 38 |
|
39 |
| -import org.springframework.core.annotation.AnnotationUtilsTests.WebController; |
40 |
| -import org.springframework.core.annotation.AnnotationUtilsTests.WebMapping; |
| 39 | +import org.springframework.core.annotation.AnnotationUtilsTests.*; |
41 | 40 | import org.springframework.stereotype.Component;
|
42 | 41 | import org.springframework.stereotype.Indexed;
|
43 | 42 | import org.springframework.util.Assert;
|
|
55 | 54 | *
|
56 | 55 | * @author Sam Brannen
|
57 | 56 | * @author Rossen Stoyanchev
|
| 57 | + * @author Juergen Hoeller |
58 | 58 | * @since 4.0.3
|
59 | 59 | * @see AnnotationUtilsTests
|
60 | 60 | * @see MultipleComposedAnnotationsOnSingleAnnotatedElementTests
|
@@ -92,6 +92,10 @@ public void getMetaAnnotationTypesOnClassWithMetaDepth2() {
|
92 | 92 | assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class, Indexed.class), names);
|
93 | 93 | }
|
94 | 94 |
|
| 95 | + private Set<String> names(Class<?>... classes) { |
| 96 | + return stream(classes).map(Class::getName).collect(toSet()); |
| 97 | + } |
| 98 | + |
95 | 99 | @Test
|
96 | 100 | public void hasMetaAnnotationTypesOnNonAnnotatedClass() {
|
97 | 101 | assertFalse(hasMetaAnnotationTypes(NonAnnotatedClass.class, TX_NAME));
|
@@ -204,15 +208,6 @@ public void getAllAnnotationAttributesOnClassWithMultipleComposedAnnotations() {
|
204 | 208 | attributes.get("value"));
|
205 | 209 | }
|
206 | 210 |
|
207 |
| - @Test |
208 |
| - @Ignore("To be validated by ") |
209 |
| - public void getAllMergedAnnotationsOnClassWithInterface() throws NoSuchMethodException { |
210 |
| - Method m = TransactionalServiceImpl.class.getMethod("doIt"); |
211 |
| - Set<Transactional> allMergedAnnotations = |
212 |
| - getAllMergedAnnotations(m, Transactional.class); |
213 |
| - assertEquals(1, allMergedAnnotations.size()); |
214 |
| - } |
215 |
| - |
216 | 211 | @Test
|
217 | 212 | public void getMergedAnnotationAttributesOnClassWithLocalAnnotation() {
|
218 | 213 | Class<?> element = TxConfig.class;
|
@@ -725,8 +720,18 @@ public void javaxAnnotationTypeViaFindMergedAnnotation() throws Exception {
|
725 | 720 | assertEquals(SpringAppConfigClass.class.getAnnotation(Resource.class), findMergedAnnotation(SpringAppConfigClass.class, Resource.class));
|
726 | 721 | }
|
727 | 722 |
|
728 |
| - private Set<String> names(Class<?>... classes) { |
729 |
| - return stream(classes).map(Class::getName).collect(toSet()); |
| 723 | + @Test |
| 724 | + public void getAllMergedAnnotationsOnClassWithInterface() throws Exception { |
| 725 | + Method m = TransactionalServiceImpl.class.getMethod("doIt"); |
| 726 | + Set<Transactional> allMergedAnnotations = getAllMergedAnnotations(m, Transactional.class); |
| 727 | + assertTrue(allMergedAnnotations.isEmpty()); |
| 728 | + } |
| 729 | + |
| 730 | + @Test |
| 731 | + public void findAllMergedAnnotationsOnClassWithInterface() throws Exception { |
| 732 | + Method m = TransactionalServiceImpl.class.getMethod("doIt"); |
| 733 | + Set<Transactional> allMergedAnnotations = findAllMergedAnnotations(m, Transactional.class); |
| 734 | + assertEquals(1, allMergedAnnotations.size()); |
730 | 735 | }
|
731 | 736 |
|
732 | 737 |
|
|
0 commit comments