@Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);
    mDiskCacheReadProducer =
        new DiskCacheReadProducer(mDiskCachesStoreSupplier, mCacheKeyFactory, mInputProducer);
    List<CacheKey> keys = new ArrayList<>(1);
    keys.add(new SimpleCacheKey("http://dummy.uri"));
    mCacheKey = new MultiCacheKey(keys);
    mIntermediatePooledByteBuffer = mock(PooledByteBuffer.class);
    mFinalPooledByteBuffer = mock(PooledByteBuffer.class);
    mIntermediateImageReference = CloseableReference.of(mIntermediatePooledByteBuffer);
    mFinalImageReference = CloseableReference.of(mFinalPooledByteBuffer);
    mIntermediateEncodedImage = new EncodedImage(mIntermediateImageReference);
    mFinalEncodedImage = new EncodedImage(mFinalImageReference);
    mIsCancelled = ArgumentCaptor.forClass(AtomicBoolean.class);

    mProducerContext =
        new SettableProducerContext(
            mImageRequest,
            mRequestId,
            mProducerListener,
            mCallerContext,
            ImageRequest.RequestLevel.FULL_FETCH,
            false,
            true,
            Priority.MEDIUM,
            mConfig);
    mLowestLevelProducerContext =
        new SettableProducerContext(
            mImageRequest,
            mRequestId,
            mProducerListener,
            mCallerContext,
            ImageRequest.RequestLevel.DISK_CACHE,
            false,
            true,
            Priority.MEDIUM,
            mConfig);
    when(mProducerListener.requiresExtraMap(mProducerContext, PRODUCER_NAME)).thenReturn(true);
    when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, mCallerContext)).thenReturn(mCacheKey);
    when(mImageRequest.getCacheChoice()).thenReturn(ImageRequest.CacheChoice.DEFAULT);
    when(mImageRequest.isDiskCacheEnabled()).thenReturn(true);
    DiskCachesStore diskCachesStore = mock(DiskCachesStore.class);
    when(mDiskCachesStoreSupplier.get()).thenReturn(diskCachesStore);
    when(diskCachesStore.getMainBufferedDiskCache()).thenReturn(mDefaultBufferedDiskCache);
    when(diskCachesStore.getSmallImageBufferedDiskCache()).thenReturn(mSmallImageBufferedDiskCache);
    when(diskCachesStore.getDynamicBufferedDiskCaches())
        .thenReturn(ImmutableMap.copyOf(mDynamicBufferedDiskCaches));
  }
Checks basic properties of disk cache producer operation, that is: - it delegates to the {@link
BufferedDiskCache#get(CacheKey key, AtomicBoolean isCancelled)} - it returns a 'copy' of the
cached value - if {@link BufferedDiskCache#get(CacheKey key, AtomicBoolean isCancelled)} is
unsuccessful, then it passes the request to the next producer in the sequence. - if the next
producer returns the value, then it is put into the disk cache.
imagepipeline/src/test/java/com/facebook/imagepipeline/producers/DiskCacheReadProducerTest.java