use of cn.taketoday.test.context.ContextLoader in project today-infrastructure by TAKETODAY.
the class GenericXmlContextLoaderResourceLocationsTests method assertContextConfigurationLocations.
@ParameterizedTest(name = "[{index}] {0}")
@MethodSource("contextConfigurationLocationsData")
void assertContextConfigurationLocations(Class<?> testClass, String[] expectedLocations) throws Exception {
ContextConfiguration contextConfig = testClass.getAnnotation(ContextConfiguration.class);
ContextLoader contextLoader = new GenericXmlContextLoader();
String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig);
String[] processedLocations = contextLoader.processLocations(testClass, configuredLocations);
if (logger.isDebugEnabled()) {
logger.debug("----------------------------------------------------------------------");
logger.debug("Configured locations: " + ObjectUtils.nullSafeToString(configuredLocations));
logger.debug("Expected locations: " + ObjectUtils.nullSafeToString(expectedLocations));
logger.debug("Processed locations: " + ObjectUtils.nullSafeToString(processedLocations));
}
assertThat(processedLocations).as("Verifying locations for test [" + testClass + "].").isEqualTo(expectedLocations);
}
use of cn.taketoday.test.context.ContextLoader in project today-framework by TAKETODAY.
the class GenericXmlContextLoaderResourceLocationsTests method assertContextConfigurationLocations.
@ParameterizedTest(name = "[{index}] {0}")
@MethodSource("contextConfigurationLocationsData")
void assertContextConfigurationLocations(Class<?> testClass, String[] expectedLocations) throws Exception {
ContextConfiguration contextConfig = testClass.getAnnotation(ContextConfiguration.class);
ContextLoader contextLoader = new GenericXmlContextLoader();
String[] configuredLocations = (String[]) AnnotationUtils.getValue(contextConfig);
String[] processedLocations = contextLoader.processLocations(testClass, configuredLocations);
if (logger.isDebugEnabled()) {
logger.debug("----------------------------------------------------------------------");
logger.debug("Configured locations: " + ObjectUtils.nullSafeToString(configuredLocations));
logger.debug("Expected locations: " + ObjectUtils.nullSafeToString(expectedLocations));
logger.debug("Processed locations: " + ObjectUtils.nullSafeToString(processedLocations));
}
assertThat(processedLocations).as("Verifying locations for test [" + testClass + "].").isEqualTo(expectedLocations);
}
Aggregations