Search in sources :

Example 16 with MergedContextConfiguration

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

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithAnnotationsAndOverriddenClasses.

@Test
public void buildMergedConfigWithAnnotationsAndOverriddenClasses() {
    Class<?> testClass = OverriddenClassesBar.class;
    Class<?>[] expectedClasses = new 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 17 with MergedContextConfiguration

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

the class AnnotationConfigContextLoaderTests method configMustNotContainLocations.

/**
	 * @since 4.0.4
	 */
@Test
public void configMustNotContainLocations() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(containsString("does not support resource locations"));
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), new String[] { "config.xml" }, EMPTY_CLASS_ARRAY, EMPTY_STRING_ARRAY, contextLoader);
    contextLoader.loadContext(mergedConfig);
}
Also used : MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 18 with MergedContextConfiguration

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

the class BootstrapTestUtilsContextInitializerTests method buildMergedConfigWithOverriddenInitializersAndClasses.

@Test
public void buildMergedConfigWithOverriddenInitializersAndClasses() {
    Class<?> testClass = OverriddenInitializersAndClassesBar.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, classes(BarConfig.class), initializers(BarInitializer.class), DelegatingSmartContextLoader.class);
}
Also used : MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 19 with MergedContextConfiguration

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

the class BootstrapTestUtilsContextInitializerTests method buildMergedConfigWithLocalAndInheritedInitializer.

@Test
public void buildMergedConfigWithLocalAndInheritedInitializer() {
    Class<?> testClass = InitializersBar.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, classes(FooConfig.class, BarConfig.class), initializers(FooInitializer.class, BarInitializer.class), DelegatingSmartContextLoader.class);
}
Also used : MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 20 with MergedContextConfiguration

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

the class BootstrapTestUtilsContextInitializerTests method buildMergedConfigWithLocalInitializerAndConfigClass.

@Test
public void buildMergedConfigWithLocalInitializerAndConfigClass() {
    Class<?> testClass = InitializersFoo.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, classes(FooConfig.class), initializers(FooInitializer.class), DelegatingSmartContextLoader.class);
}
Also used : 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