|
25 | 25 | import org.springframework.test.context.ContextConfiguration;
|
26 | 26 | import org.springframework.test.context.ContextLoader;
|
27 | 27 | import org.springframework.test.context.MergedContextConfiguration;
|
| 28 | +import org.springframework.test.context.web.WebDelegatingSmartContextLoader; |
| 29 | +import org.springframework.test.context.web.WebMergedContextConfiguration; |
| 30 | + |
| 31 | +import static org.junit.Assert.*; |
28 | 32 |
|
29 | 33 | /**
|
30 | 34 | * Unit tests for {@link ContextLoaderUtils} involving {@link MergedContextConfiguration}.
|
@@ -94,6 +98,28 @@ public void buildMergedConfigWithLocalAnnotationAndClasses() {
|
94 | 98 | DelegatingSmartContextLoader.class);
|
95 | 99 | }
|
96 | 100 |
|
| 101 | + /** |
| 102 | + * Introduced to investigate claims made in a discussion on |
| 103 | + * <a href="http://stackoverflow.com/questions/24725438/what-could-cause-a-class-implementing-applicationlistenercontextrefreshedevent">Stack Overflow</a>. |
| 104 | + */ |
| 105 | + @Test |
| 106 | + public void buildMergedConfigWithAtWebAppConfigurationWithAnnotationAndClassesOnSuperclass() { |
| 107 | + Class<?> webTestClass = WebClassesFoo.class; |
| 108 | + Class<?> standardTestClass = ClassesFoo.class; |
| 109 | + WebMergedContextConfiguration webMergedConfig = (WebMergedContextConfiguration) buildMergedContextConfiguration(webTestClass); |
| 110 | + MergedContextConfiguration standardMergedConfig = buildMergedContextConfiguration(standardTestClass); |
| 111 | + |
| 112 | + assertEquals(webMergedConfig, webMergedConfig); |
| 113 | + assertEquals(standardMergedConfig, standardMergedConfig); |
| 114 | + assertNotEquals(standardMergedConfig, webMergedConfig); |
| 115 | + assertNotEquals(webMergedConfig, standardMergedConfig); |
| 116 | + |
| 117 | + assertMergedConfig(webMergedConfig, webTestClass, EMPTY_STRING_ARRAY, new Class<?>[] { FooConfig.class }, |
| 118 | + WebDelegatingSmartContextLoader.class); |
| 119 | + assertMergedConfig(standardMergedConfig, standardTestClass, EMPTY_STRING_ARRAY, |
| 120 | + new Class<?>[] { FooConfig.class }, DelegatingSmartContextLoader.class); |
| 121 | + } |
| 122 | + |
97 | 123 | @Test
|
98 | 124 | public void buildMergedConfigWithLocalAnnotationAndOverriddenContextLoaderAndLocations() {
|
99 | 125 | Class<?> testClass = PropertiesLocationsFoo.class;
|
|
0 commit comments