@Test
  public void testSmallImageDiskCacheGetSuccessful() {
    setUpDiskCacheProducerEnabled(true);
    when(mImageRequest.getCacheChoice()).thenReturn(ImageRequest.CacheChoice.SMALL);
    setupDiskCacheGetSuccess(mSmallImageBufferedDiskCache);
    mDiskCacheReadProducer.produceResults(mConsumer, mProducerContext);
    verify(mConsumer).onNewResult(mFinalEncodedImage, Consumer.IS_LAST);
    verify(mProducerListener).onProducerStart(mProducerContext, PRODUCER_NAME);
    ArgumentCaptor<HashMap> captor = ArgumentCaptor.forClass(HashMap.class);
    verify(mProducerListener)
        .onProducerFinishWithSuccess(eq(mProducerContext), eq(PRODUCER_NAME), captor.capture());
    Map<String, String> resultMap = captor.getValue();
    assertEquals("true", resultMap.get(DiskCacheReadProducer.EXTRA_CACHED_VALUE_FOUND));
    assertEquals("0", resultMap.get(DiskCacheReadProducer.ENCODED_IMAGE_SIZE));
    verify(mProducerListener).onUltimateProducerReached(mProducerContext, PRODUCER_NAME, true);
    Assert.assertFalse(EncodedImage.isValid(mFinalEncodedImage));
  }
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