@Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);
    mBitmapMemoryCacheGetProducer =
        new BitmapMemoryCacheGetProducer(mMemoryCache, mCacheKeyFactory, mInputProducer);
    mCloseableImage1 = mock(CloseableImage.class);
    mFinalImageReference = CloseableReference.of(mCloseableImage1);
    when(mCloseableImage1.getQualityInfo()).thenReturn(ImmutableQualityInfo.FULL_QUALITY);

    when(mProducerContext.getImageRequest()).thenReturn(mImageRequest);
    when(mProducerContext.getProducerListener()).thenReturn(mProducerListener);
    when(mProducerContext.getId()).thenReturn(mRequestId);
    when(mProducerListener.requiresExtraMap(eq(mProducerContext), eq(PRODUCER_NAME)))
        .thenReturn(true);
    when(mProducerContext.getLowestPermittedRequestLevel())
        .thenReturn(ImageRequest.RequestLevel.FULL_FETCH);
    when(mProducerContext.getCallerContext()).thenReturn(PRODUCER_NAME);
    when(mCacheKeyFactory.getBitmapCacheKey(mImageRequest, PRODUCER_NAME)).thenReturn(mCacheKey);
    when(mImageRequest.isCacheEnabled(ImageRequest.CachesLocationsMasks.BITMAP_READ))
        .thenReturn(true);
    when(mImageRequest.isCacheEnabled(ImageRequest.CachesLocationsMasks.BITMAP_WRITE))
        .thenReturn(true);
  }
Checks basic properties of bitmap memory cache producer operation, that is: - it delegates to the
{@link MemoryCache#get(Object)}. - if get is successful, then returned reference is closed. - if
{@link MemoryCache#get(Object)} is unsuccessful, then it passes the request to the next producer
in the sequence. - responses from the next producer are passed directly to the consumer. -
listener methods are called as expected.
imagepipeline/src/test/java/com/facebook/imagepipeline/producers/BitmapMemoryCacheGetProducerTest.java