Search in sources :

Example 6 with DescriptionBuilder

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

the class IsValidUnboundedLocalCache method matchesSafely.

@Override
protected boolean matchesSafely(UnboundedLocalCache<K, V> map, Description description) {
    desc = new DescriptionBuilder(description);
    checkMap(map, desc);
    return desc.matches();
}
Also used : DescriptionBuilder(com.github.benmanes.caffeine.testing.DescriptionBuilder)

Example 7 with DescriptionBuilder

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

the class IsValidSingleConsumerQueue method matchesSafely.

@Override
protected boolean matchesSafely(SingleConsumerQueue<E> queue, Description description) {
    DescriptionBuilder builder = new DescriptionBuilder(description);
    if (queue.isEmpty()) {
        builder.expectThat("empty queue", queue, is(deeplyEmpty()));
        builder.expectThat("empty queue", queue.head, is(queue.tail));
        builder.expectThat("empty queue", queue.head.next, is(nullValue()));
    }
    builder.expectThat("corrupted queue node", queue.tail.next, is(nullValue()));
    checkForLoop(queue, builder);
    checkArena(queue, builder);
    return builder.matches();
}
Also used : DescriptionBuilder(com.github.benmanes.caffeine.testing.DescriptionBuilder)

Aggregations

DescriptionBuilder (com.github.benmanes.caffeine.testing.DescriptionBuilder)7 CacheStats (com.github.benmanes.caffeine.cache.stats.CacheStats)1