@Test public void testMaxCapacity() { TestCacheEvictionCallBack callBack = new TestCacheEvictionCallBack(); CascadingCache<Object, Object> cache = getDirectMappedCache( 10, callBack ); for( int i = 0; i < cache.getCapacity() + 10; i++ ) cache.put( i, i ); assertEquals( cache.getCapacity(), cache.size() ); assertEquals( 10, callBack.evictionCounter ); }