Search in sources :

Example 1 with BootstrapContext

use of org.springframework.test.context.BootstrapContext in project spring-boot by spring-projects.

the class SpringBootTestContextBootstrapperTests method buildTestContext.

@SuppressWarnings("rawtypes")
private void buildTestContext(Class<?> testClass) {
    SpringBootTestContextBootstrapper bootstrapper = new SpringBootTestContextBootstrapper();
    BootstrapContext bootstrapContext = mock(BootstrapContext.class);
    bootstrapper.setBootstrapContext(bootstrapContext);
    given((Class) bootstrapContext.getTestClass()).willReturn(testClass);
    CacheAwareContextLoaderDelegate contextLoaderDelegate = mock(CacheAwareContextLoaderDelegate.class);
    given(bootstrapContext.getCacheAwareContextLoaderDelegate()).willReturn(contextLoaderDelegate);
    bootstrapper.buildTestContext();
}
Also used : CacheAwareContextLoaderDelegate(org.springframework.test.context.CacheAwareContextLoaderDelegate) BootstrapContext(org.springframework.test.context.BootstrapContext) SpringBootTestContextBootstrapper(org.springframework.boot.test.context.SpringBootTestContextBootstrapper)

Example 2 with BootstrapContext

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

the class AbstractContextConfigurationUtilsTests method buildMergedContextConfiguration.

MergedContextConfiguration buildMergedContextConfiguration(Class<?> testClass) {
    CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate = Mockito.mock(CacheAwareContextLoaderDelegate.class);
    BootstrapContext bootstrapContext = BootstrapTestUtils.buildBootstrapContext(testClass, cacheAwareContextLoaderDelegate);
    TestContextBootstrapper bootstrapper = BootstrapTestUtils.resolveTestContextBootstrapper(bootstrapContext);
    return bootstrapper.buildMergedContextConfiguration();
}
Also used : CacheAwareContextLoaderDelegate(org.springframework.test.context.CacheAwareContextLoaderDelegate) BootstrapContext(org.springframework.test.context.BootstrapContext) TestContextBootstrapper(org.springframework.test.context.TestContextBootstrapper)

Aggregations

BootstrapContext (org.springframework.test.context.BootstrapContext)2 CacheAwareContextLoaderDelegate (org.springframework.test.context.CacheAwareContextLoaderDelegate)2 SpringBootTestContextBootstrapper (org.springframework.boot.test.context.SpringBootTestContextBootstrapper)1 TestContextBootstrapper (org.springframework.test.context.TestContextBootstrapper)1