|
|
|
@ -27,6 +27,7 @@ import java.lang.reflect.Method;
@@ -27,6 +27,7 @@ import java.lang.reflect.Method;
|
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
import org.junit.Ignore; |
|
|
|
|
import org.junit.Rule; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
import org.junit.rules.ExpectedException; |
|
|
|
@ -294,6 +295,29 @@ public class AnnotatedElementUtilsTests {
@@ -294,6 +295,29 @@ public class AnnotatedElementUtilsTests {
|
|
|
|
|
assertTrue(isAnnotated(element, name)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Ignore("Disabled until SPR-13554 is addressed") |
|
|
|
|
@Test |
|
|
|
|
public void getMergedAnnotationAttributesWithHalfConventionBasedAndHalfAliasedComposedAnnotation() { |
|
|
|
|
for (Class<?> clazz : asList(HalfConventionBasedAndHalfAliasedComposedContextConfigClassV1.class, |
|
|
|
|
HalfConventionBasedAndHalfAliasedComposedContextConfigClassV2.class)) { |
|
|
|
|
getMergedAnnotationAttributesWithHalfConventionBasedAndHalfAliasedComposedAnnotation(clazz); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void getMergedAnnotationAttributesWithHalfConventionBasedAndHalfAliasedComposedAnnotation(Class<?> clazz) { |
|
|
|
|
String[] expected = new String[] { "explicitDeclaration" }; |
|
|
|
|
String name = ContextConfig.class.getName(); |
|
|
|
|
String simpleName = clazz.getSimpleName(); |
|
|
|
|
AnnotationAttributes attributes = getMergedAnnotationAttributes(clazz, name); |
|
|
|
|
|
|
|
|
|
assertNotNull("Should find @ContextConfig on " + simpleName, attributes); |
|
|
|
|
assertArrayEquals("locations for class [" + clazz.getSimpleName() + "]", expected, attributes.getStringArray("locations")); |
|
|
|
|
assertArrayEquals("value for class [" + clazz.getSimpleName() + "]", expected, attributes.getStringArray("value")); |
|
|
|
|
|
|
|
|
|
// Verify contracts between utility methods:
|
|
|
|
|
assertTrue(isAnnotated(clazz, name)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void getMergedAnnotationAttributesWithAliasedComposedAnnotation() { |
|
|
|
|
Class<?> element = AliasedComposedContextConfigClass.class; |
|
|
|
@ -772,6 +796,17 @@ public class AnnotatedElementUtilsTests {
@@ -772,6 +796,17 @@ public class AnnotatedElementUtilsTests {
|
|
|
|
|
String[] locations(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ContextConfig |
|
|
|
|
@Retention(RetentionPolicy.RUNTIME) |
|
|
|
|
@interface HalfConventionBasedAndHalfAliasedComposedContextConfig { |
|
|
|
|
|
|
|
|
|
String[] locations() default {}; |
|
|
|
|
|
|
|
|
|
@AliasFor(annotation = ContextConfig.class, attribute = "locations") |
|
|
|
|
String[] xmlConfigFiles() default {}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ContextConfig |
|
|
|
|
@Retention(RetentionPolicy.RUNTIME) |
|
|
|
|
@interface AliasedComposedContextConfig { |
|
|
|
@ -1040,6 +1075,14 @@ public class AnnotatedElementUtilsTests {
@@ -1040,6 +1075,14 @@ public class AnnotatedElementUtilsTests {
|
|
|
|
|
static class InvalidConventionBasedComposedContextConfigClass { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@HalfConventionBasedAndHalfAliasedComposedContextConfig(xmlConfigFiles = "explicitDeclaration") |
|
|
|
|
static class HalfConventionBasedAndHalfAliasedComposedContextConfigClassV1 { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@HalfConventionBasedAndHalfAliasedComposedContextConfig(locations = "explicitDeclaration") |
|
|
|
|
static class HalfConventionBasedAndHalfAliasedComposedContextConfigClassV2 { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@AliasedComposedContextConfig(xmlConfigFiles = "test.xml") |
|
|
|
|
static class AliasedComposedContextConfigClass { |
|
|
|
|
} |
|
|
|
|