@Test
  public void testDoesNotWriteResultToCacheIfResultStatusSaysNotTo() {
    setupInputProducerSuccessWithStatusFlags(
        Consumer.DO_NOT_CACHE_ENCODED, mFinalEncodedImageFormatUnknown);
    mDiskCacheWriteProducer.produceResults(mConsumer, mProducerContext);
    verify(mConsumer).onNewResult(mIntermediateEncodedImage, Consumer.DO_NOT_CACHE_ENCODED);
    verify(mConsumer)
        .onNewResult(
            mFinalEncodedImageFormatUnknown, Consumer.IS_LAST | Consumer.DO_NOT_CACHE_ENCODED);
    verify(mProducerListener, times(2)).onProducerStart(mProducerContext, PRODUCER_NAME);
    verify(mProducerListener, times(2))
        .onProducerFinishWithSuccess(mProducerContext, PRODUCER_NAME, null);
    verifyNoMoreInteractions(
        mCacheKeyFactory, mDefaultBufferedDiskCache, mSmallImageBufferedDiskCache);
  }
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/DiskCacheWriteProducerTest.java