Fix handling of annotations on super classes in AnnotationsPropertySource

Closes gh-6006
This commit is contained in:
Andy Wilkinson
2016-05-23 12:35:00 +01:00
parent 3d0b682f0f
commit e9a226c8f8
2 changed files with 38 additions and 2 deletions

View File

@@ -169,6 +169,22 @@ public class AnnotationsPropertySourceTests {
new AnnotationsPropertySource(PropertyMappedWithSelfAnnotatingAnnotation.class);
}
@Test
public void typeLevelAnnotationOnSuperClass() {
AnnotationsPropertySource source = new AnnotationsPropertySource(
PropertyMappedAnnotationOnSuperClass.class);
assertThat(source.getPropertyNames()).containsExactly("value");
assertThat(source.getProperty("value")).isEqualTo("abc");
}
@Test
public void aliasedPropertyMappedAttributeOnSuperClass() {
AnnotationsPropertySource source = new AnnotationsPropertySource(
AliasedPropertyMappedAnnotationOnSuperClass.class);
assertThat(source.getPropertyNames()).containsExactly("aliasing.value");
assertThat(source.getProperty("aliasing.value")).isEqualTo("baz");
}
static class NoAnnotation {
}
@@ -359,4 +375,13 @@ public class AnnotationsPropertySourceTests {
}
static class PropertyMappedAnnotationOnSuperClass extends TypeLevel {
}
static class AliasedPropertyMappedAnnotationOnSuperClass
extends PropertyMappedAttributeWithAnAlias {
}
}