use of org.springframework.test.context.ContextConfigurationAttributes in project spring-framework by spring-projects.
the class DelegatingSmartContextLoaderTests method processContextConfigurationWithConfigurationClass.
@Test
public void processContextConfigurationWithConfigurationClass() {
Class<?>[] classes = new Class<?>[] { getClass() };
ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes(getClass(), EMPTY_STRING_ARRAY, classes, true, null, true, ContextLoader.class);
loader.processContextConfiguration(configAttributes);
assertArrayEquals(classes, configAttributes.getClasses());
assertEmpty(configAttributes.getLocations());
}
use of org.springframework.test.context.ContextConfigurationAttributes in project spring-framework by spring-projects.
the class DelegatingSmartContextLoaderTests method processContextConfigurationWithDefaultXmlConfigGeneration.
// --- SmartContextLoader - processContextConfiguration() ------------------
@Test
public void processContextConfigurationWithDefaultXmlConfigGeneration() {
ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes(XmlTestCase.class, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class);
loader.processContextConfiguration(configAttributes);
assertEquals(1, configAttributes.getLocations().length);
assertEmpty(configAttributes.getClasses());
}
use of org.springframework.test.context.ContextConfigurationAttributes in project spring-framework by spring-projects.
the class DelegatingSmartContextLoaderTests method processContextConfigurationWithDefaultXmlConfigAndConfigurationClassGeneration.
@Test
public void processContextConfigurationWithDefaultXmlConfigAndConfigurationClassGeneration() {
expectedException.expect(IllegalStateException.class);
expectedException.expectMessage(containsString("both default locations AND default configuration classes were detected"));
ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes(ImproperDuplicateDefaultXmlAndConfigClassTestCase.class, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class);
loader.processContextConfiguration(configAttributes);
}
use of org.springframework.test.context.ContextConfigurationAttributes in project spring-framework by spring-projects.
the class DelegatingSmartContextLoaderTests method processContextConfigurationWithDefaultConfigurationClassGeneration.
@Test
public void processContextConfigurationWithDefaultConfigurationClassGeneration() {
ContextConfigurationAttributes configAttributes = new ContextConfigurationAttributes(ConfigClassTestCase.class, EMPTY_STRING_ARRAY, EMPTY_CLASS_ARRAY, true, null, true, ContextLoader.class);
loader.processContextConfiguration(configAttributes);
assertEquals(1, configAttributes.getClasses().length);
assertEmpty(configAttributes.getLocations());
}
use of org.springframework.test.context.ContextConfigurationAttributes in project spring-framework by spring-projects.
the class AbstractTestContextBootstrapper method buildDefaultMergedContextConfiguration.
private MergedContextConfiguration buildDefaultMergedContextConfiguration(Class<?> testClass, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) {
List<ContextConfigurationAttributes> defaultConfigAttributesList = Collections.singletonList(new ContextConfigurationAttributes(testClass));
ContextLoader contextLoader = resolveContextLoader(testClass, defaultConfigAttributesList);
if (logger.isInfoEnabled()) {
logger.info(String.format("Neither @ContextConfiguration nor @ContextHierarchy found for test class [%s], using %s", testClass.getName(), contextLoader.getClass().getSimpleName()));
}
return buildMergedContextConfiguration(testClass, defaultConfigAttributesList, null, cacheAwareContextLoaderDelegate, false);
}
Aggregations