diff --git a/spring-test/src/main/java/org/springframework/test/context/BootstrapContext.java b/spring-test/src/main/java/org/springframework/test/context/BootstrapContext.java index 13c311fa79..19a7e89ace 100644 --- a/spring-test/src/main/java/org/springframework/test/context/BootstrapContext.java +++ b/spring-test/src/main/java/org/springframework/test/context/BootstrapContext.java @@ -35,7 +35,8 @@ public interface BootstrapContext { /** * Get the {@link CacheAwareContextLoaderDelegate} to use for transparent - * interaction with the context cache. + * interaction with the {@code ContextCache}. + * @return the context loader delegate (never {@code null}) */ CacheAwareContextLoaderDelegate getCacheAwareContextLoaderDelegate(); diff --git a/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java b/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java index d0f9c07e89..bf84a9a80e 100644 --- a/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/BootstrapUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,8 @@ package org.springframework.test.context; +import java.lang.reflect.Constructor; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,6 +38,10 @@ import static org.springframework.core.annotation.AnnotationUtils.*; */ abstract class BootstrapUtils { + private static final String DEFAULT_BOOTSTRAP_CONTEXT_CLASS_NAME = "org.springframework.test.context.support.DefaultBootstrapContext"; + + private static final String DEFAULT_CACHE_AWARE_CONTEXT_LOADER_DELEGATE_CLASS_NAME = "org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate"; + private static final String DEFAULT_TEST_CONTEXT_BOOTSTRAPPER_CLASS_NAME = "org.springframework.test.context.support.DefaultTestContextBootstrapper"; private static final Log logger = LogFactory.getLog(BootstrapUtils.class); @@ -45,6 +51,55 @@ abstract class BootstrapUtils { /* no-op */ } + /** + * Create the {@code BootstrapContext} for the specified {@linkplain Class test class}. + * + *
Uses reflection to create a {@link org.springframework.test.context.support.DefaultBootstrapContext} + * that uses a {@link org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate}. + * + * @param testClass the test class for which the bootstrap context should be created + * @return a new {@code BootstrapContext}; never {@code null} + */ + @SuppressWarnings("unchecked") + static BootstrapContext createBootstrapContext(Class> testClass) { + CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate = createCacheAwareContextLoaderDelegate(); + + Class extends BootstrapContext> clazz = null; + try { + clazz = (Class extends BootstrapContext>) ClassUtils.forName(DEFAULT_BOOTSTRAP_CONTEXT_CLASS_NAME, + BootstrapUtils.class.getClassLoader()); + + Constructor extends BootstrapContext> constructor = clazz.getConstructor(Class.class, + CacheAwareContextLoaderDelegate.class); + + if (logger.isDebugEnabled()) { + logger.debug(String.format("Instantiating BootstrapContext using constructor [%s]", constructor)); + } + return instantiateClass(constructor, testClass, cacheAwareContextLoaderDelegate); + } + catch (Throwable t) { + throw new IllegalStateException("Could not load BootstrapContext [" + clazz + "]", t); + } + } + + @SuppressWarnings("unchecked") + private static CacheAwareContextLoaderDelegate createCacheAwareContextLoaderDelegate() { + Class extends CacheAwareContextLoaderDelegate> clazz = null; + try { + clazz = (Class extends CacheAwareContextLoaderDelegate>) ClassUtils.forName( + DEFAULT_CACHE_AWARE_CONTEXT_LOADER_DELEGATE_CLASS_NAME, BootstrapUtils.class.getClassLoader()); + + if (logger.isDebugEnabled()) { + logger.debug(String.format("Instantiating CacheAwareContextLoaderDelegate from class [%s]", + clazz.getName())); + } + return instantiateClass(clazz, CacheAwareContextLoaderDelegate.class); + } + catch (Throwable t) { + throw new IllegalStateException("Could not load CacheAwareContextLoaderDelegate [" + clazz + "]", t); + } + } + /** * Resolve the {@link TestContextBootstrapper} type for the test class in the * supplied {@link BootstrapContext}, instantiate it, and provide it a reference diff --git a/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java b/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java index 5dfd5705b2..459c5a5c9c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java +++ b/spring-test/src/main/java/org/springframework/test/context/CacheAwareContextLoaderDelegate.java @@ -40,6 +40,8 @@ public interface CacheAwareContextLoaderDelegate { * configured in the given {@code MergedContextConfiguration}. *
If the context is present in the {@code ContextCache} it will simply * be returned; otherwise, it will be loaded, stored in the cache, and returned. + *
The cache statistics should be logged by invoking + * {@link ContextCache#logStatistics()}. * @param mergedContextConfiguration the merged context configuration to use * to load the application context; never {@code null} * @return the application context diff --git a/spring-test/src/main/java/org/springframework/test/context/ContextCache.java b/spring-test/src/main/java/org/springframework/test/context/ContextCache.java index 6dafc4a4cd..cbf13e432a 100644 --- a/spring-test/src/main/java/org/springframework/test/context/ContextCache.java +++ b/spring-test/src/main/java/org/springframework/test/context/ContextCache.java @@ -41,6 +41,13 @@ import org.springframework.test.annotation.DirtiesContext.HierarchyMode; */ public interface ContextCache { + /** + * The name of the logging category used for reporting {@code ContextCache} + * statistics. + */ + public static final String CONTEXT_CACHE_LOGGING_CATEGORY = "org.springframework.test.context.cache"; + + /** * Determine whether there is a cached context for the given key. * @param key the context key (never {@code null}) @@ -126,19 +133,18 @@ public interface ContextCache { void clearStatistics(); /** - * Generate a text string containing the implementation type of this - * cache and its statistics. - *
The value returned by this method will be used primarily for - * logging purposes. - *
Specifically, the returned string should contain the name of the - * concrete {@code ContextCache} implementation, the {@linkplain #size}, - * {@linkplain #getParentContextCount() parent context count}, - * {@linkplain #getHitCount() hit count}, {@linkplain #getMissCount() - * miss count}, and any other information useful in monitoring the - * state of this cache. - * @return a string representation of this cache, including statistics + * Log the statistics for this {@code ContextCache} at {@code DEBUG} level + * using the {@value #CONTEXT_CACHE_LOGGING_CATEGORY} logging category. + *
The following information should be logged. + *
The default implementation creates a {@link DefaultBootstrapContext} that - * uses the {@link DefaultCacheAwareContextLoaderDelegate}. + *
The default implementation creates a + * {@link org.springframework.test.context.support.DefaultBootstrapContext DefaultBootstrapContext} + * that uses a + * {@link org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate DefaultCacheAwareContextLoaderDelegate}. *
Can be overridden by subclasses as necessary. * @param testClass the test class for which the bootstrap context should be created * @return a new {@code BootstrapContext}; never {@code null} */ protected BootstrapContext createBootstrapContext(Class> testClass) { - CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate = new DefaultCacheAwareContextLoaderDelegate(); - return new DefaultBootstrapContext(testClass, cacheAwareContextLoaderDelegate); + return BootstrapUtils.createBootstrapContext(testClass); } /** diff --git a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java index d538777e57..c6b1b0b15c 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/AbstractTestContextBootstrapper.java @@ -38,6 +38,7 @@ import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.io.support.SpringFactoriesLoader; import org.springframework.test.context.BootstrapContext; import org.springframework.test.context.CacheAwareContextLoaderDelegate; +import org.springframework.test.context.ContextCache; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfigurationAttributes; import org.springframework.test.context.ContextHierarchy; @@ -67,6 +68,9 @@ import org.springframework.util.StringUtils; *
To plug in custom {@link ContextCache} support, override + * {@link #getCacheAwareContextLoaderDelegate()}. + * * @author Sam Brannen * @author Juergen Hoeller * @since 4.1 @@ -96,17 +100,17 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot /** * Build a new {@link DefaultTestContext} using the {@linkplain Class test class} - * and {@link CacheAwareContextLoaderDelegate} in the {@link BootstrapContext} - * associated with this bootstrapper and by delegating to - * {@link #buildMergedContextConfiguration()}. + * in the {@link BootstrapContext} associated with this bootstrapper and + * by delegating to {@link #buildMergedContextConfiguration()} and + * {@link #getCacheAwareContextLoaderDelegate()}. *
Concrete subclasses may choose to override this method to return a * custom {@link TestContext} implementation. * @since 4.2 */ @Override public TestContext buildTestContext() { - return new DefaultTestContext(bootstrapContext.getTestClass(), buildMergedContextConfiguration(), - bootstrapContext.getCacheAwareContextLoaderDelegate()); + return new DefaultTestContext(getBootstrapContext().getTestClass(), buildMergedContextConfiguration(), + getCacheAwareContextLoaderDelegate()); } /** @@ -282,7 +286,7 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot @Override public final MergedContextConfiguration buildMergedContextConfiguration() { Class> testClass = getBootstrapContext().getTestClass(); - CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate = getBootstrapContext().getCacheAwareContextLoaderDelegate(); + CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate = getCacheAwareContextLoaderDelegate(); if (MetaAnnotationUtils.findAnnotationDescriptorForTypes(testClass, ContextConfiguration.class, ContextHierarchy.class) == null) { @@ -471,6 +475,20 @@ public abstract class AbstractTestContextBootstrapper implements TestContextBoot return null; } + /** + * Get the {@link CacheAwareContextLoaderDelegate} to use for transparent + * interaction with the {@code ContextCache}. + *
The default implementation simply delegates to + * {@code getBootstrapContext().getCacheAwareContextLoaderDelegate()}. + *
Concrete subclasses may choose to override this method to return a + * custom {@code CacheAwareContextLoaderDelegate} implementation with + * custom {@link ContextCache} support. + * @return the context loader delegate (never {@code null}) + */ + protected CacheAwareContextLoaderDelegate getCacheAwareContextLoaderDelegate() { + return getBootstrapContext().getCacheAwareContextLoaderDelegate(); + } + /** * Determine the default {@link ContextLoader} {@linkplain Class class} * to use for the supplied test class. diff --git a/spring-test/src/main/java/org/springframework/test/context/DefaultBootstrapContext.java b/spring-test/src/main/java/org/springframework/test/context/support/DefaultBootstrapContext.java similarity index 70% rename from spring-test/src/main/java/org/springframework/test/context/DefaultBootstrapContext.java rename to spring-test/src/main/java/org/springframework/test/context/support/DefaultBootstrapContext.java index e40802a7be..d541c29b0d 100644 --- a/spring-test/src/main/java/org/springframework/test/context/DefaultBootstrapContext.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/DefaultBootstrapContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,9 +14,11 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.support; import org.springframework.core.style.ToStringCreator; +import org.springframework.test.context.BootstrapContext; +import org.springframework.test.context.CacheAwareContextLoaderDelegate; import org.springframework.util.Assert; /** @@ -25,13 +27,19 @@ import org.springframework.util.Assert; * @author Sam Brannen * @since 4.1 */ -class DefaultBootstrapContext implements BootstrapContext { +public class DefaultBootstrapContext implements BootstrapContext { private final Class> testClass; private final CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate; - DefaultBootstrapContext(Class> testClass, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) { + /** + * Construct a new {@code DefaultBootstrapContext} from the supplied arguments. + * @param testClass the test class for this bootstrap context; never {@code null} + * @param cacheAwareContextLoaderDelegate the context loader delegate to use for + * transparent interaction with the {@code ContextCache}; never {@code null} + */ + public DefaultBootstrapContext(Class> testClass, CacheAwareContextLoaderDelegate cacheAwareContextLoaderDelegate) { Assert.notNull(testClass, "Test class must not be null"); Assert.notNull(cacheAwareContextLoaderDelegate, "CacheAwareContextLoaderDelegate must not be null"); this.testClass = testClass; diff --git a/spring-test/src/main/java/org/springframework/test/context/DefaultCacheAwareContextLoaderDelegate.java b/spring-test/src/main/java/org/springframework/test/context/support/DefaultCacheAwareContextLoaderDelegate.java similarity index 72% rename from spring-test/src/main/java/org/springframework/test/context/DefaultCacheAwareContextLoaderDelegate.java rename to spring-test/src/main/java/org/springframework/test/context/support/DefaultCacheAwareContextLoaderDelegate.java index cfa482c321..7598fa9eb9 100644 --- a/spring-test/src/main/java/org/springframework/test/context/DefaultCacheAwareContextLoaderDelegate.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/DefaultCacheAwareContextLoaderDelegate.java @@ -14,34 +14,37 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.support; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationContext; import org.springframework.test.annotation.DirtiesContext.HierarchyMode; -import org.springframework.test.context.support.DefaultContextCache; +import org.springframework.test.context.CacheAwareContextLoaderDelegate; +import org.springframework.test.context.ContextCache; +import org.springframework.test.context.ContextLoader; +import org.springframework.test.context.MergedContextConfiguration; +import org.springframework.test.context.SmartContextLoader; import org.springframework.util.Assert; /** * Default implementation of the {@link CacheAwareContextLoaderDelegate} interface. * + *
To use a static {@code DefaultContextCache}, invoke the + * {@link #DefaultCacheAwareContextLoaderDelegate()} constructor; otherwise, + * invoke the {@link #DefaultCacheAwareContextLoaderDelegate(ContextCache)} + * and provide a custom {@link ContextCache} implementation. + * * @author Sam Brannen * @since 4.1 */ -class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContextLoaderDelegate { +public class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContextLoaderDelegate { private static final Log logger = LogFactory.getLog(DefaultCacheAwareContextLoaderDelegate.class); - private static final Log statsLogger = LogFactory.getLog("org.springframework.test.context.cache"); - /** - * Default cache of Spring application contexts. - * - *
This default cache is static, so that each context can be cached - * and reused for all subsequent tests that declare the same unique - * context configuration within the same JVM process. + * Default static cache of Spring application contexts. */ static final ContextCache defaultContextCache = new DefaultContextCache(); @@ -50,28 +53,39 @@ class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContextLoaderD /** * Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using - * a static {@code DefaultContextCache}. + * a static {@link DefaultContextCache}. + *
This default cache is static so that each context can be cached + * and reused for all subsequent tests that declare the same unique + * context configuration within the same JVM process. + * @see #DefaultCacheAwareContextLoaderDelegate(ContextCache) */ - DefaultCacheAwareContextLoaderDelegate() { + public DefaultCacheAwareContextLoaderDelegate() { this(defaultContextCache); } /** * Construct a new {@code DefaultCacheAwareContextLoaderDelegate} using - * the supplied {@code ContextCache}. + * the supplied {@link ContextCache}. + * @see #DefaultCacheAwareContextLoaderDelegate() */ - DefaultCacheAwareContextLoaderDelegate(ContextCache contextCache) { + public DefaultCacheAwareContextLoaderDelegate(ContextCache contextCache) { Assert.notNull(contextCache, "ContextCache must not be null"); this.contextCache = contextCache; } + /** + * Get the {@link ContextCache} used by this context loader delegate. + */ + protected ContextCache getContextCache() { + return this.contextCache; + } /** * Load the {@code ApplicationContext} for the supplied merged context configuration. *
Supports both the {@link SmartContextLoader} and {@link ContextLoader} SPIs. * @throws Exception if an error occurs while loading the application context */ - private ApplicationContext loadContextInternal(MergedContextConfiguration mergedContextConfiguration) + protected ApplicationContext loadContextInternal(MergedContextConfiguration mergedContextConfiguration) throws Exception { ContextLoader contextLoader = mergedContextConfiguration.getContextLoader(); @@ -118,9 +132,7 @@ class DefaultCacheAwareContextLoaderDelegate implements CacheAwareContextLoaderD } } - if (statsLogger.isDebugEnabled()) { - statsLogger.debug("Spring test ApplicationContext cache statistics: " + this.contextCache); - } + this.contextCache.logStatistics(); return context; } diff --git a/spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java b/spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java index 17ebcb82b1..bcb5c21df4 100644 --- a/spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java +++ b/spring-test/src/main/java/org/springframework/test/context/support/DefaultContextCache.java @@ -23,6 +23,8 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.style.ToStringCreator; @@ -46,6 +48,8 @@ import org.springframework.util.ConcurrentReferenceHashMap; */ public class DefaultContextCache implements ContextCache { + private static final Log statsLogger = LogFactory.getLog(CONTEXT_CACHE_LOGGING_CATEGORY); + /** * Map of context keys to Spring {@code ApplicationContext} instances. */ @@ -240,6 +244,20 @@ public class DefaultContextCache implements ContextCache { * {@inheritDoc} */ @Override + public void logStatistics() { + if (statsLogger.isDebugEnabled()) { + statsLogger.debug("Spring test ApplicationContext cache statistics: " + this); + } + } + + /** + * Generate a text string containing the implementation type of this + * cache and its statistics. + *
The string returned by this method contains all information + * required for compliance with the contract for {@link #logStatistics()}. + * @return a string representation of this cache, including statistics + */ + @Override public String toString() { return new ToStringCreator(this) .append("size", size()) diff --git a/spring-test/src/test/java/org/springframework/test/context/BootstrapTestUtils.java b/spring-test/src/test/java/org/springframework/test/context/BootstrapTestUtils.java index b3b4fa5fb4..af6c4f7f5e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/BootstrapTestUtils.java +++ b/spring-test/src/test/java/org/springframework/test/context/BootstrapTestUtils.java @@ -16,6 +16,8 @@ package org.springframework.test.context; +import org.springframework.test.context.support.DefaultBootstrapContext; + /** * Collection of test-related utility methods for working with {@link BootstrapContext * BootstrapContexts} and {@link TestContextBootstrapper TestContextBootstrappers}. diff --git a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java b/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java index 528ef70450..3b45f158d6 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTestNGTests.java @@ -37,7 +37,7 @@ import org.springframework.test.context.testng.TrackingTestNGTestListener; import org.testng.TestNG; import static org.junit.Assert.*; -import static org.springframework.test.context.ContextCacheTestUtils.*; +import static org.springframework.test.context.support.ContextCacheTestUtils.*; /** * JUnit 4 based integration test which verifies correct {@linkplain ContextCache diff --git a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java b/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java index 6a73bfa4e0..64dced85b8 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/ClassLevelDirtiesContextTests.java @@ -36,7 +36,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import static org.junit.Assert.*; -import static org.springframework.test.context.ContextCacheTestUtils.*; +import static org.springframework.test.context.support.ContextCacheTestUtils.*; /** * JUnit 4 based integration test which verifies correct {@linkplain ContextCache diff --git a/spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java b/spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java index abd36808f8..e8a4c3e48f 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/ContextCacheTests.java @@ -18,6 +18,7 @@ package org.springframework.test.context; import org.junit.Before; import org.junit.Test; + import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Configuration; import org.springframework.test.annotation.DirtiesContext.HierarchyMode; @@ -26,7 +27,7 @@ import org.springframework.test.context.support.DefaultContextCache; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.*; -import static org.springframework.test.context.ContextCacheTestUtils.*; +import static org.springframework.test.context.support.ContextCacheTestUtils.*; /** * Integration tests for verifying proper behavior of the {@link ContextCache} in diff --git a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java b/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java index 030bfa9e88..622d25f88d 100644 --- a/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/SpringRunnerContextCacheTests.java @@ -31,7 +31,7 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution import org.springframework.test.context.support.DirtiesContextTestExecutionListener; import static org.junit.Assert.*; -import static org.springframework.test.context.ContextCacheTestUtils.*; +import static org.springframework.test.context.support.ContextCacheTestUtils.*; /** * JUnit 4 based unit test which verifies correct {@link ContextCache diff --git a/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java b/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java index da43525bc0..47ec34ebd5 100644 --- a/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java +++ b/spring-test/src/test/java/org/springframework/test/context/TestContextTestUtils.java @@ -16,6 +16,9 @@ package org.springframework.test.context; +import org.springframework.test.context.support.DefaultBootstrapContext; +import org.springframework.test.context.support.DefaultCacheAwareContextLoaderDelegate; + /** * Collection of test-related utility methods for working with {@link TestContext TestContexts}. * diff --git a/spring-test/src/test/java/org/springframework/test/context/ContextCacheTestUtils.java b/spring-test/src/test/java/org/springframework/test/context/support/ContextCacheTestUtils.java similarity index 96% rename from spring-test/src/test/java/org/springframework/test/context/ContextCacheTestUtils.java rename to spring-test/src/test/java/org/springframework/test/context/support/ContextCacheTestUtils.java index 6291e5a1d2..c6127b47c7 100644 --- a/spring-test/src/test/java/org/springframework/test/context/ContextCacheTestUtils.java +++ b/spring-test/src/test/java/org/springframework/test/context/support/ContextCacheTestUtils.java @@ -14,7 +14,9 @@ * limitations under the License. */ -package org.springframework.test.context; +package org.springframework.test.context.support; + +import org.springframework.test.context.ContextCache; import static org.junit.Assert.*;