Introduce tests for Spring Boot issue 885

This commit introduces unit tests that attempt to reproduce the problem
described in Spring Boot issue 885; however, the tests pass and
therefore do not confirm the reported problem.

See: https://github.com/spring-projects/spring-boot/issues/885
This commit is contained in:
Sam Brannen 2014-07-04 16:10:52 +02:00
parent b6a7957dc4
commit 58955236ee
1 changed files with 38 additions and 0 deletions

View File

@ -16,7 +16,13 @@
package org.springframework.test.context.support;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.ContextLoader;
import org.springframework.test.context.MergedContextConfiguration;
@ -66,6 +72,19 @@ public class ContextLoaderUtilsMergedConfigTests extends AbstractContextLoaderUt
DelegatingSmartContextLoader.class);
}
@Test
public void buildMergedConfigWithMetaAnnotationAndClasses() {
buildMergedConfigWithMetaAnnotationAndClasses(Dog.class);
buildMergedConfigWithMetaAnnotationAndClasses(WorkingDog.class);
buildMergedConfigWithMetaAnnotationAndClasses(GermanShepherd.class);
}
private void buildMergedConfigWithMetaAnnotationAndClasses(Class<?> testClass) {
MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, new Class<?>[] { FooConfig.class,
BarConfig.class }, DelegatingSmartContextLoader.class);
}
@Test
public void buildMergedConfigWithLocalAnnotationAndClasses() {
Class<?> testClass = ClassesFoo.class;
@ -135,4 +154,23 @@ public class ContextLoaderUtilsMergedConfigTests extends AbstractContextLoaderUt
AnnotationConfigContextLoader.class);
}
@ContextConfiguration
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public static @interface SpringAppConfig {
Class<?>[] classes() default {};
}
@SpringAppConfig(classes = { FooConfig.class, BarConfig.class })
public static abstract class Dog {
}
public static abstract class WorkingDog extends Dog {
}
public static class GermanShepherd extends WorkingDog {
}
}