assertNotNull("Cache1 retrieval error after unrelated eviction: expected to retrieve " + CAPITAL + " for " + key, cache1.get(key, CAPITAL));
// Note: because these tests are normally executed without a server, the interceptor
// MBeans are usually not available for use in the tests. Consequently it's necessary
// to obtain a reference to the interceptor and work with it directly.
InvalidationInterceptor mgmt1 = TestingUtil.findInterceptor(cache1, InvalidationInterceptor.class);
assertNotNull("Cache1 InvalidationInterceptor not found.", mgmt1);
InvalidationInterceptor mgmt2 = TestingUtil.findInterceptor(cache2, InvalidationInterceptor.class);
assertNotNull("Cache2 InvalidationInterceptor not found.", mgmt2);
assertTrue("Cache1 not configured to use MBeans", cache1.getConfiguration().getExposeManagementStatistics());
assertTrue("Cache2 not configured to use MBeans", cache2.getConfiguration().getExposeManagementStatistics());
assertTrue("InvalidationInterceptor on Cache1 not set up to use statistics!", mgmt1.getStatisticsEnabled());
assertTrue("InvalidationInterceptor on Cache2 not set up to use statistics!", mgmt2.getStatisticsEnabled());
// verify basic statistics for entries loaded into cache
assertEquals("Cache1 Invalidations count error: ", new Long(6), new Long(mgmt1.getInvalidations()));
assertEquals("Cache2 Invalidations count error: ", new Long(9), new Long(mgmt2.getInvalidations()));
// reset statistics
mgmt1.resetStatistics();
mgmt2.resetStatistics();
// check the statistics again
assertEquals("Cache1 Invalidations count error after reset: ", new Long(0), new Long(mgmt1.getInvalidations()));
assertEquals("Cache2 Invalidations count error after reset: ", new Long(0), new Long(mgmt2.getInvalidations()));
}