@Test
  public void testUpdatesCacheParams() {
    mCache =
        createDummyAdaptiveCountingMemoryCache(
            mParamsSupplier,
            mCacheTrimStrategy,
            mValueDescriptor,
            100,
            1,
            2,
            initialLFUCacheFractionPromil);
    InOrder inOrder = inOrder(mParamsSupplier);

    CloseableReference<Integer> originalRef = newReference(400);
    CloseableReference<Integer> cachedRef = mCache.cache(KEYS[2], originalRef);
    originalRef.close();
    cachedRef.close();

    mCache.get(KEY);
    inOrder.verify(mParamsSupplier).get();

    mockedSystemClock
        .when(() -> SystemClock.uptimeMillis())
        .thenReturn(PARAMS_CHECK_INTERVAL_MS - 1);
    mCache.get(KEY);
    inOrder.verify(mParamsSupplier, never()).get();
    mCache.get(KEY);
    inOrder.verify(mParamsSupplier, never()).get();

    assertTotalSize(1, 400);
    assertExclusivelyOwnedSize(1, 400);

    mParams =
        new MemoryCacheParams(
            300 /* cache max size */,
            CACHE_MAX_COUNT,
            CACHE_EVICTION_QUEUE_MAX_SIZE,
            CACHE_EVICTION_QUEUE_MAX_COUNT,
            CACHE_ENTRY_MAX_SIZE,
            PARAMS_CHECK_INTERVAL_MS);
    when(mParamsSupplier.get()).thenReturn(mParams);

    mockedSystemClock.when(() -> SystemClock.uptimeMillis()).thenReturn(PARAMS_CHECK_INTERVAL_MS);
    mCache.get(KEY);
    inOrder.verify(mParamsSupplier).get();

    assertTotalSize(0, 0);
    assertExclusivelyOwnedSize(0, 0);
    verify(mReleaser).release(400);
  }
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