Search in sources :

Example 21 with MergedContextConfiguration

use of org.springframework.test.context.MergedContextConfiguration in project spring-framework by spring-projects.

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithAtWebAppConfigurationWithAnnotationAndClassesOnSuperclass.

/**
	 * Introduced to investigate claims made in a discussion on
	 * <a href="http://stackoverflow.com/questions/24725438/what-could-cause-a-class-implementing-applicationlistenercontextrefreshedevent">Stack Overflow</a>.
	 */
@Test
public void buildMergedConfigWithAtWebAppConfigurationWithAnnotationAndClassesOnSuperclass() {
    Class<?> webTestClass = WebClassesFoo.class;
    Class<?> standardTestClass = ClassesFoo.class;
    WebMergedContextConfiguration webMergedConfig = (WebMergedContextConfiguration) buildMergedContextConfiguration(webTestClass);
    MergedContextConfiguration standardMergedConfig = buildMergedContextConfiguration(standardTestClass);
    assertEquals(webMergedConfig, webMergedConfig);
    assertEquals(standardMergedConfig, standardMergedConfig);
    assertNotEquals(standardMergedConfig, webMergedConfig);
    assertNotEquals(webMergedConfig, standardMergedConfig);
    assertMergedConfig(webMergedConfig, webTestClass, EMPTY_STRING_ARRAY, new Class<?>[] { FooConfig.class }, WebDelegatingSmartContextLoader.class);
    assertMergedConfig(standardMergedConfig, standardTestClass, EMPTY_STRING_ARRAY, new Class<?>[] { FooConfig.class }, DelegatingSmartContextLoader.class);
}
Also used : WebMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration) WebMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration) MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 22 with MergedContextConfiguration

use of org.springframework.test.context.MergedContextConfiguration in project spring-framework by spring-projects.

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithLocalAndInheritedAnnotationsAndLocations.

@Test
public void buildMergedConfigWithLocalAndInheritedAnnotationsAndLocations() {
    Class<?> testClass = LocationsBar.class;
    String[] expectedLocations = new String[] { "/foo.xml", "/bar.xml" };
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, expectedLocations, EMPTY_CLASS_ARRAY, AnnotationConfigContextLoader.class);
}
Also used : WebMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration) MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 23 with MergedContextConfiguration

use of org.springframework.test.context.MergedContextConfiguration in project spring-framework by spring-projects.

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithLocalAndInheritedAnnotationsAndClasses.

@Test
public void buildMergedConfigWithLocalAndInheritedAnnotationsAndClasses() {
    Class<?> testClass = ClassesBar.class;
    Class<?>[] expectedClasses = new Class<?>[] { FooConfig.class, BarConfig.class };
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, expectedClasses, AnnotationConfigContextLoader.class);
}
Also used : WebMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration) MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 24 with MergedContextConfiguration

use of org.springframework.test.context.MergedContextConfiguration in project spring-framework by spring-projects.

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithBareAnnotations.

@Test
public void buildMergedConfigWithBareAnnotations() {
    Class<?> testClass = BareAnnotations.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, new String[] { "classpath:org/springframework/test/context/support/AbstractContextConfigurationUtilsTests$BareAnnotations-context.xml" }, EMPTY_CLASS_ARRAY, DelegatingSmartContextLoader.class);
}
Also used : WebMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration) MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 25 with MergedContextConfiguration

use of org.springframework.test.context.MergedContextConfiguration in project spring-framework by spring-projects.

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithMetaAnnotationAndLocations.

@Test
public void buildMergedConfigWithMetaAnnotationAndLocations() {
    Class<?> testClass = MetaLocationsFoo.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, new String[] { "classpath:/foo.xml" }, EMPTY_CLASS_ARRAY, DelegatingSmartContextLoader.class);
}
Also used : WebMergedContextConfiguration(org.springframework.test.context.web.WebMergedContextConfiguration) MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Aggregations

MergedContextConfiguration (org.springframework.test.context.MergedContextConfiguration)32 Test (org.junit.Test)25 WebMergedContextConfiguration (org.springframework.test.context.web.WebMergedContextConfiguration)13 ArrayList (java.util.ArrayList)3 ContextConfigurationAttributes (org.springframework.test.context.ContextConfigurationAttributes)2 List (java.util.List)1 ApplicationContext (org.springframework.context.ApplicationContext)1 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)1 CacheAwareContextLoaderDelegate (org.springframework.test.context.CacheAwareContextLoaderDelegate)1 ContextConfiguration (org.springframework.test.context.ContextConfiguration)1 ContextCustomizer (org.springframework.test.context.ContextCustomizer)1 ContextHierarchy (org.springframework.test.context.ContextHierarchy)1 ContextLoader (org.springframework.test.context.ContextLoader)1 SmartContextLoader (org.springframework.test.context.SmartContextLoader)1 TestContext (org.springframework.test.context.TestContext)1