}
}
}
// Test the statistics.
CacheStatistics stats = cache.getStatistics();
int expectedHits = ( ( ( HIGH - LOW - removedKeys.size() ) * ITERS ) + DIRECT );
int expectedMiss = ( ITERS * removedKeys.size() );
/* Due to the nature of how the various providers do their work, the expected values
* should be viewed as minimum values, not exact values.
*/
assertTrue( "Cache hit count should exceed [" + expectedHits + "], but was actually [" + stats.getCacheHits()
+ "]", expectedHits <= stats.getCacheHits() );
assertTrue( "Cache miss count should exceed [" + expectedMiss + "], but was actually [" + stats.getCacheMiss()
+ "]", expectedMiss <= stats.getCacheMiss() );
/* For the same reason as above, the hit rate is completely un-testable.
* Leaving this commented so that future developers understand the reason we are not
* testing this value.