@ -20,6 +20,7 @@ import java.io.Serializable;
@@ -20,6 +20,7 @@ import java.io.Serializable;
import java.lang.annotation.Annotation ;
import java.lang.annotation.Documented ;
import java.lang.annotation.ElementType ;
import java.lang.annotation.Inherited ;
import java.lang.annotation.Retention ;
import java.lang.annotation.RetentionPolicy ;
import java.lang.annotation.Target ;
@ -52,7 +53,7 @@ import static org.junit.Assert.*;
@@ -52,7 +53,7 @@ import static org.junit.Assert.*;
public class AnnotationMetadataTests {
@Test
public void standardAnnotationMetadata ( ) throws Exception {
public void standardAnnotationMetadata ( ) {
AnnotationMetadata metadata = new StandardAnnotationMetadata ( AnnotatedComponent . class , true ) ;
doTestAnnotationInfo ( metadata ) ;
doTestMethodAnnotationInfo ( metadata ) ;
@ -68,7 +69,7 @@ public class AnnotationMetadataTests {
@@ -68,7 +69,7 @@ public class AnnotationMetadataTests {
}
@Test
public void standardAnnotationMetadataForSubclass ( ) throws Exception {
public void standardAnnotationMetadataForSubclass ( ) {
AnnotationMetadata metadata = new StandardAnnotationMetadata ( AnnotatedComponentSubClass . class , true ) ;
doTestSubClassAnnotationInfo ( metadata ) ;
}
@ -104,7 +105,7 @@ public class AnnotationMetadataTests {
@@ -104,7 +105,7 @@ public class AnnotationMetadataTests {
}
@Test
public void standardAnnotationMetadataForInterface ( ) throws Exception {
public void standardAnnotationMetadataForInterface ( ) {
AnnotationMetadata metadata = new StandardAnnotationMetadata ( AnnotationMetadata . class , true ) ;
doTestMetadataForInterfaceClass ( metadata ) ;
}
@ -132,7 +133,7 @@ public class AnnotationMetadataTests {
@@ -132,7 +133,7 @@ public class AnnotationMetadataTests {
}
@Test
public void standardAnnotationMetadataForAnnotation ( ) throws Exception {
public void standardAnnotationMetadataForAnnotation ( ) {
AnnotationMetadata metadata = new StandardAnnotationMetadata ( Component . class , true ) ;
doTestMetadataForAnnotationClass ( metadata ) ;
}
@ -172,7 +173,7 @@ public class AnnotationMetadataTests {
@@ -172,7 +173,7 @@ public class AnnotationMetadataTests {
* ' true ' as is done in the main test above .
* /
@Test
public void standardAnnotationMetadata_nestedAnnotationsAsMap_false ( ) throws Exception {
public void standardAnnotationMetadata_nestedAnnotationsAsMap_false ( ) {
AnnotationMetadata metadata = new StandardAnnotationMetadata ( AnnotatedComponent . class ) ;
AnnotationAttributes specialAttrs = ( AnnotationAttributes ) metadata . getAnnotationAttributes ( SpecialAttr . class . getName ( ) ) ;
Annotation [ ] nestedAnnoArray = ( Annotation [ ] ) specialAttrs . get ( "nestedAnnoArray" ) ;
@ -233,6 +234,20 @@ public class AnnotationMetadataTests {
@@ -233,6 +234,20 @@ public class AnnotationMetadataTests {
assertMultipleAnnotationsWithIdenticalAttributeNames ( metadata ) ;
}
@Test
public void inheritedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingStandardAnnotationMetadata ( ) {
AnnotationMetadata metadata = new StandardAnnotationMetadata ( NamedComposedAnnotationExtended . class ) ;
assertFalse ( metadata . hasAnnotation ( NamedComposedAnnotation . class . getName ( ) ) ) ;
}
@Test
public void inheritedAnnotationWithMetaAnnotationsWithIdenticalAttributeNamesUsingAnnotationMetadataReadingVisitor ( ) throws Exception {
MetadataReaderFactory metadataReaderFactory = new SimpleMetadataReaderFactory ( ) ;
MetadataReader metadataReader = metadataReaderFactory . getMetadataReader ( NamedComposedAnnotationExtended . class . getName ( ) ) ;
AnnotationMetadata metadata = metadataReader . getAnnotationMetadata ( ) ;
assertFalse ( metadata . hasAnnotation ( NamedComposedAnnotation . class . getName ( ) ) ) ;
}
private void assertMultipleAnnotationsWithIdenticalAttributeNames ( AnnotationMetadata metadata ) {
AnnotationAttributes attributes1 = ( AnnotationAttributes ) metadata . getAnnotationAttributes (
@ -545,6 +560,7 @@ public class AnnotationMetadataTests {
@@ -545,6 +560,7 @@ public class AnnotationMetadataTests {
@NamedAnnotation3 ( name = "name 3" )
@Retention ( RetentionPolicy . RUNTIME )
@Target ( ElementType . TYPE )
@Inherited
public @interface NamedComposedAnnotation {
}
@ -552,4 +568,7 @@ public class AnnotationMetadataTests {
@@ -552,4 +568,7 @@ public class AnnotationMetadataTests {
public static class NamedComposedAnnotationClass {
}
public static class NamedComposedAnnotationExtended extends NamedComposedAnnotationClass {
}
}