Search in sources :

Example 1 with CheckNoStats

use of com.github.benmanes.caffeine.cache.testing.CheckNoStats in project caffeine by ben-manes.

the class CacheTest method stats.

/* ---------------- stats -------------- */
@CacheSpec
@CheckNoWriter
@CheckNoStats
@Test(dataProvider = "caches")
public void stats(Cache<Integer, Integer> cache, CacheContext context) {
    CacheStats stats = cache.stats().plus(new CacheStats(1, 2, 3, 4, 5, 6, 7).minus(new CacheStats(6, 5, 4, 3, 2, 1, 0)));
    assertThat(stats, is(new CacheStats(0, 0, 0, 1, 3, 5, 7)));
    assertThat(cache.policy().isRecordingStats(), is(context.isRecordingStats()));
}
Also used : CacheStats(com.github.benmanes.caffeine.cache.stats.CacheStats) CheckNoWriter(com.github.benmanes.caffeine.cache.testing.CheckNoWriter) Test(org.testng.annotations.Test) CheckNoStats(com.github.benmanes.caffeine.cache.testing.CheckNoStats) CacheSpec(com.github.benmanes.caffeine.cache.testing.CacheSpec)

Aggregations

CacheStats (com.github.benmanes.caffeine.cache.stats.CacheStats)1 CacheSpec (com.github.benmanes.caffeine.cache.testing.CacheSpec)1 CheckNoStats (com.github.benmanes.caffeine.cache.testing.CheckNoStats)1 CheckNoWriter (com.github.benmanes.caffeine.cache.testing.CheckNoWriter)1 Test (org.testng.annotations.Test)1