@Test
  public void testEviction_ByEvictionQueueSize() {
    // Cache has 4 entries; 3 for LFU and 1 for MFU
    // key is considered as MFU, if its accessCount > 1
    mCache =
        createDummyAdaptiveCountingMemoryCache(
            mParamsSupplier, mCacheTrimStrategy, mValueDescriptor, 100, 1, 2, 750);

    CloseableReference<Integer> originalRef1 = newReference(200);
    CloseableReference<Integer> valueRef1 = mCache.cache(KEYS[1], originalRef1);
    originalRef1.close();
    valueRef1.close();
    CloseableReference<Integer> originalRef2 = newReference(300);
    CloseableReference<Integer> valueRef2 = mCache.cache(KEYS[2], originalRef2);
    originalRef2.close();
    valueRef2.close();
    CloseableReference<Integer> originalRef3 = newReference(400);
    CloseableReference<Integer> valueRef3 = mCache.cache(KEYS[3], originalRef3);
    originalRef3.close();
    assertTotalSize(3, 900);
    assertExclusivelyOwnedSize(2, 500);
    assertExclusivelyOwned(KEYS[1], 200);
    assertExclusivelyOwned(KEYS[2], 300);
    assertSharedWithCount(KEYS[3], 400, 1);

    // closing the client reference for item3 will cause item1 to be evicted
    valueRef3.close();
    assertTotalSize(2, 700);
    assertExclusivelyOwnedSize(2, 700);
    assertNotCached(KEYS[1], 200);
    assertExclusivelyOwned(KEYS[2], 300);
    assertExclusivelyOwned(KEYS[3], 400);
    verify(mReleaser).release(200);
  }
test: pass illegal adaptive rate and illegal initial LFU cache fraction. expected result: fall
back and use the default adaptive rate and initial LFU fraction values.
imagepipeline-base/src/test/java/com/facebook/imagepipeline/cache/AbstractAdaptiveCountingMemoryCacheTest.java