@Test
  public void testCacheHit() {
    when(mMemoryCache.get(mPostprocessedBitmapCacheKey)).thenReturn(mImageRef2Clone);

    mMemoryCacheProducer.produceResults(mConsumer, mProducerContext);

    verify(mInputProducer, never()).produceResults(any(Consumer.class), any(ProducerContext.class));
    verify(mProducerListener).onProducerStart(mProducerContext, PRODUCER_NAME);
    verify(mProducerListener)
        .onProducerFinishWithSuccess(mProducerContext, PRODUCER_NAME, mExtraOnHit);
    verify(mProducerListener).onUltimateProducerReached(mProducerContext, PRODUCER_NAME, true);
    verify(mConsumer).onNewResult(mImageRef2Clone, Consumer.IS_LAST);
    // reference must be closed after `consumer.onNewResult` returns
    Assert.assertFalse(mImageRef2Clone.isValid());
  }
Checks basic properties of post-processed bitmap memory cache producer operation, that is: - it
delegates to the {@link MemoryCache#get(Object)} - if {@link MemoryCache#get(Object)} 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 bitmap cache. - responses from the next
producer are passed back down to the consumer.
imagepipeline/src/test/java/com/facebook/imagepipeline/producers/PostprocessedBitmapMemoryCacheProducerTest.java