Introduce resetContextCache() in ContextCacheTestUtils
This commit is contained in:
parent
dc345dcb3d
commit
0e287c1a90
|
|
@ -79,8 +79,9 @@ public class ClassLevelDirtiesContextTestNGTests {
|
|||
|
||||
@BeforeClass
|
||||
public static void verifyInitialCacheState() {
|
||||
ContextCache contextCache = TestContextManager.contextCache;
|
||||
contextCache.reset();
|
||||
resetContextCache();
|
||||
// Reset static counters in case tests are run multiple times in a test suite --
|
||||
// for example, via JUnit's @Suite.
|
||||
cacheHits.set(0);
|
||||
cacheMisses.set(0);
|
||||
assertContextCacheStatistics("BeforeClass", 0, cacheHits.get(), cacheMisses.get());
|
||||
|
|
|
|||
|
|
@ -74,8 +74,9 @@ public class ClassLevelDirtiesContextTests {
|
|||
|
||||
@BeforeClass
|
||||
public static void verifyInitialCacheState() {
|
||||
ContextCache contextCache = TestContextManager.contextCache;
|
||||
contextCache.reset();
|
||||
resetContextCache();
|
||||
// Reset static counters in case tests are run multiple times in a test suite --
|
||||
// for example, via JUnit's @Suite.
|
||||
cacheHits.set(0);
|
||||
cacheMisses.set(0);
|
||||
assertContextCacheStatistics("BeforeClass", 0, cacheHits.get(), cacheMisses.get());
|
||||
|
|
|
|||
|
|
@ -27,6 +27,13 @@ import static org.junit.Assert.*;
|
|||
*/
|
||||
public class ContextCacheTestUtils {
|
||||
|
||||
/**
|
||||
* Reset the state of the context cache.
|
||||
*/
|
||||
public static final void resetContextCache() {
|
||||
TestContextManager.contextCache.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert the statistics of the context cache in {@link TestContextManager}.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ public class SpringRunnerContextCacheTests {
|
|||
@BeforeClass
|
||||
public static void verifyInitialCacheState() {
|
||||
dirtiedApplicationContext = null;
|
||||
ContextCache contextCache = TestContextManager.contextCache;
|
||||
contextCache.reset();
|
||||
resetContextCache();
|
||||
assertContextCacheStatistics("BeforeClass", 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue