@Test
  public void testNewRequestGetsIntermediateResult() {
    mMultiplexProducer.produceResults(mConsumer1, mProducerContext1);
    mForwardingConsumer1.onNewResult(mIntermediateImageReference1, Consumer.NO_FLAGS);
    mForwardingConsumer1.onNewResult(mIntermediateImageReference2, TEST_FLAG);
    ArgumentCaptor<CloseableReference> imageReferenceCaptor =
        ArgumentCaptor.forClass(CloseableReference.class);
    mMultiplexProducer.produceResults(mConsumer2, mProducerContext2);
    verify(mConsumer2).onNewResult(imageReferenceCaptor.capture(), eq(TEST_FLAG));
    assertEquals(
        imageReferenceCaptor.getValue().getUnderlyingReferenceTestOnly(),
        mIntermediateImageReference2.getUnderlyingReferenceTestOnly());
  }
An extra flag to check we maintain other flags than just whether this is the last result
imagepipeline/src/test/java/com/facebook/imagepipeline/producers/MultiplexProducerTest.java