Search in sources :

Example 6 with MergedContextConfiguration

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

the class GenericPropertiesContextLoaderTests method configMustNotContainAnnotatedClasses.

@Test
public void configMustNotContainAnnotatedClasses() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(containsString("does not support annotated classes"));
    GenericPropertiesContextLoader loader = new GenericPropertiesContextLoader();
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, new Class<?>[] { getClass() }, EMPTY_STRING_ARRAY, loader);
    loader.loadContext(mergedConfig);
}
Also used : MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 7 with MergedContextConfiguration

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

the class GenericXmlContextLoaderTests method configMustNotContainAnnotatedClasses.

@Test
public void configMustNotContainAnnotatedClasses() throws Exception {
    expectedException.expect(IllegalStateException.class);
    expectedException.expectMessage(containsString("does not support annotated classes"));
    GenericXmlContextLoader loader = new GenericXmlContextLoader();
    MergedContextConfiguration mergedConfig = new MergedContextConfiguration(getClass(), EMPTY_STRING_ARRAY, new Class<?>[] { getClass() }, EMPTY_STRING_ARRAY, loader);
    loader.loadContext(mergedConfig);
}
Also used : MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 8 with MergedContextConfiguration

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

the class BootstrapTestUtilsContextInitializerTests method buildMergedConfigWithSingleLocalInitializer.

@Test
public void buildMergedConfigWithSingleLocalInitializer() {
    Class<?> testClass = SingleInitializer.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, initializers(FooInitializer.class), DelegatingSmartContextLoader.class);
}
Also used : MergedContextConfiguration(org.springframework.test.context.MergedContextConfiguration) Test(org.junit.Test)

Example 9 with MergedContextConfiguration

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

the class BootstrapTestUtilsContextInitializerTests method buildMergedConfigWithOverriddenInitializers.

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

Example 10 with MergedContextConfiguration

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

the class BootstrapTestUtilsMergedConfigTests method buildMergedConfigWithLocalAnnotationAndClasses.

@Test
public void buildMergedConfigWithLocalAnnotationAndClasses() {
    Class<?> testClass = ClassesFoo.class;
    MergedContextConfiguration mergedConfig = buildMergedContextConfiguration(testClass);
    assertMergedConfig(mergedConfig, testClass, EMPTY_STRING_ARRAY, new Class<?>[] { FooConfig.class }, 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