assertEquals(0, loader.getCount());
}
public void testComputePartiallyCollectedKey() throws ExecutionException {
CacheBuilder<Object, Object> builder = createCacheBuilder().concurrencyLevel(1);
CountingLoader loader = new CountingLoader();
LocalCache<Object, Object> map = makeLocalCache(builder);
Segment<Object, Object> segment = map.segments[0];
AtomicReferenceArray<ReferenceEntry<Object, Object>> table = segment.table;
assertEquals(0, loader.getCount());
Object key = new Object();
int hash = map.hash(key);
Object value = new Object();
int index = hash & (table.length() - 1);
DummyEntry<Object, Object> entry = DummyEntry.create(key, hash, null);
DummyValueReference<Object, Object> valueRef = DummyValueReference.create(value);
entry.setValueReference(valueRef);
table.set(index, entry);
segment.count++;
assertSame(value, map.get(key, loader));
assertEquals(0, loader.getCount());
assertEquals(1, segment.count);
entry.clearKey();
assertNotSame(value, map.get(key, loader));
assertEquals(1, loader.getCount());
assertEquals(2, segment.count);
}