Java Code Examples for com.facebook.imagepipeline.common.Priority#MEDIUM

The following examples show how to use com.facebook.imagepipeline.common.Priority#MEDIUM . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadHandoffProducerTest.java    From fresco with MIT License 6 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mTestExecutorService = new TestExecutorService(new FakeClock());
  mThreadHandoffProducer =
      new ThreadHandoffProducer(
          mInputProducer, new ThreadHandoffProducerQueueImpl(mTestExecutorService));
}
 
Example 2
Source File: QualifiedResourceFetchProducerTest.java    From fresco with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  mExecutor = new TestExecutorService(new FakeClock());
  mQualifiedResourceFetchProducer =
      new QualifiedResourceFetchProducer(mExecutor, mPooledByteBufferFactory, mContentResolver);
  mContentUri = UriUtil.getUriForQualifiedResource(PACKAGE_NAME, RESOURCE_ID);

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          REQUEST_ID,
          mProducerListener,
          CALLER_CONTEXT,
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
}
 
Example 3
Source File: LocalVideoThumbnailProducerTest.java    From fresco with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  mExecutor = new TestExecutorService(new FakeClock());
  mLocalVideoThumbnailProducer =
      new LocalVideoThumbnailProducer(
          mExecutor, RuntimeEnvironment.application.getContentResolver());
  mFile = new File(RuntimeEnvironment.application.getExternalFilesDir(null), TEST_FILENAME);

  mockStatic(ThumbnailUtils.class);
  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          false,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceFile()).thenReturn(mFile);
  mLocalVideoUri = Uri.parse("file:///dancing_hotdog.mp4");
}
 
Example 4
Source File: SettableProducerContextTest.java    From fresco with MIT License 6 votes vote down vote up
@Before
public void setUp() {
  mSettableProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mock(ProducerListener2.class),
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mCallbacks1 = mock(ProducerContextCallbacks.class);
  mCallbacks2 = mock(ProducerContextCallbacks.class);
}
 
Example 5
Source File: RepeatedPostprocessorProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mTestExecutorService = new TestExecutorService(new FakeClock());
  mPostprocessorProducer =
      new PostprocessorProducer(mInputProducer, mPlatformBitmapFactory, mTestExecutorService);
  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false /* isPrefetch */,
          false /* isIntermediateResultExpected */,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getPostprocessor()).thenReturn(mPostprocessor);
  mResults = new ArrayList<>();
  when(mPostprocessor.getName()).thenReturn(POSTPROCESSOR_NAME);
  when(mProducerListener.requiresExtraMap(mProducerContext, PRODUCER_NAME)).thenReturn(true);
  doAnswer(
          new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
              mResults.add(
                  ((CloseableReference<CloseableImage>) invocation.getArguments()[0]).clone());
              return null;
            }
          })
      .when(mConsumer)
      .onNewResult(any(CloseableReference.class), anyInt());
  mInOrder = inOrder(mPostprocessor, mProducerListener, mConsumer);
}
 
Example 6
Source File: LocalContentUriThumbnailFetchProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);

  mExecutor = new TestExecutorService(new FakeClock());
  mLocalContentUriThumbnailFetchProducer =
      new LocalContentUriThumbnailFetchProducer(
          mExecutor, mPooledByteBufferFactory, mContentResolver);
  mContentUri = Uri.parse("content://media/external/images/media/1");

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceUri()).thenReturn(mContentUri);

  mockMediaStoreCursor();
  mockThumbnailFile();
  mockContentResolver();
}
 
Example 7
Source File: LocalFileFetchProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  mExecutor = new TestExecutorService(new FakeClock());
  mLocalFileFetchProducer = new LocalFileFetchProducer(mExecutor, mPooledByteBufferFactory);
  mFile = new File(RuntimeEnvironment.application.getExternalFilesDir(null), TEST_FILENAME);
  BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(mFile));
  bos.write(new byte[INPUT_STREAM_LENGTH], 0, INPUT_STREAM_LENGTH);
  bos.close();

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceFile()).thenReturn(mFile);
  doAnswer(
          new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
              mCapturedEncodedImage =
                  EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
              return null;
            }
          })
      .when(mConsumer)
      .onNewResult(notNull(EncodedImage.class), anyInt());
}
 
Example 8
Source File: LocalContentUriFetchProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  mExecutor = new TestExecutorService(new FakeClock());
  mLocalContentUriFetchProducer =
      new LocalContentUriFetchProducer(mExecutor, mPooledByteBufferFactory, mContentResolver);
  mContentUri = Uri.fromFile(mock(File.class));

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceUri()).thenReturn(mContentUri);
  doAnswer(
          new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
              mCapturedEncodedImage =
                  EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
              return null;
            }
          })
      .when(mConsumer)
      .onNewResult(notNull(EncodedImage.class), anyInt());
}
 
Example 9
Source File: DecodeProducerTest.java    From fresco with MIT License 5 votes vote down vote up
private void setupImageRequest(String requestId, ImageRequest imageRequest) {
  mImageRequest = imageRequest;
  mRequestId = requestId;
  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          /* isPrefetch */ false,
          /* isIntermediateResultExpected */ true,
          Priority.MEDIUM,
          mConfig);
}
 
Example 10
Source File: NetworkFetchProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mNetworkFetchProducer =
      new TestNetworkFetchProducer(mPooledByteBufferFactory, mByteArrayPool, mNetworkFetcher);
  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false /* isPrefetch */,
          true /* isIntermediateResultExpected */,
          Priority.MEDIUM,
          mConfig);
  mFetchState = new FetchState(mConsumer, mProducerContext);
  mCommonByteArray = new byte[10];
  when(mByteArrayPool.get(anyInt())).thenReturn(mCommonByteArray);
  when(mPooledByteBufferFactory.newOutputStream(anyInt()))
      .thenReturn(mPooledByteBufferOutputStream);
  when(mPooledByteBufferFactory.newOutputStream()).thenReturn(mPooledByteBufferOutputStream);
  when(mPooledByteBufferOutputStream.toByteBuffer()).thenReturn(mPooledByteBuffer);
  when(mProducerListener.requiresExtraMap(mProducerContext, NetworkFetchProducer.PRODUCER_NAME))
      .thenReturn(true);
  when(mNetworkFetcher.getExtraMap(any(FetchState.class), anyInt())).thenReturn(mExtrasMap);
  when(mNetworkFetcher.createFetchState(eq(mConsumer), eq(mProducerContext)))
      .thenReturn(mFetchState);
  mTestExecutor = Executors.newCachedThreadPool();
}
 
Example 11
Source File: LocalResourceFetchProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  when(mResources.openRawResourceFd(eq(TEST_ID))).thenReturn(mAssetFileDescriptor);
  when(mAssetFileDescriptor.getLength()).thenReturn((long) TEST_DATA_LENGTH);

  mExecutor = new TestExecutorService(new FakeClock());
  mLocalResourceFetchProducer =
      new LocalResourceFetchProducer(mExecutor, mPooledByteBufferFactory, mResources);

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("res:///" + TEST_ID));
  doAnswer(
          new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
              mCapturedEncodedImage =
                  EncodedImage.cloneOrNull(((EncodedImage) invocation.getArguments()[0]));
              return null;
            }
          })
      .when(mConsumer)
      .onNewResult(notNull(EncodedImage.class), anyInt());
}
 
Example 12
Source File: LocalAssetFetchProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  MockitoAnnotations.initMocks(this);
  when(mAssetManager.openFd(eq(TEST_FILENAME))).thenReturn(mAssetFileDescriptor);
  when(mAssetFileDescriptor.getLength()).thenReturn((long) TEST_DATA_LENGTH);
  when(mPooledByteBufferFactory.newByteBuffer(any(InputStream.class), eq(TEST_DATA_LENGTH)))
      .thenReturn(mPooledByteBuffer);

  mExecutor = new TestExecutorService(new FakeClock());
  mLocalAssetFetchProducer =
      new LocalAssetFetchProducer(mExecutor, mPooledByteBufferFactory, mAssetManager);

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getSourceUri()).thenReturn(Uri.parse("asset:///" + TEST_FILENAME));
  doAnswer(
          new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
              mCapturedEncodedImage =
                  EncodedImage.cloneOrNull((EncodedImage) invocation.getArguments()[0]);
              return null;
            }
          })
      .when(mConsumer)
      .onNewResult(notNull(EncodedImage.class), anyInt());
}
 
Example 13
Source File: AnimatedRepeatedPostprocessorProducerTest.java    From fresco with MIT License 5 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mTestExecutorService = new TestExecutorService(new FakeClock());
  mPostprocessorProducer =
      new PostprocessorProducer(mInputProducer, mPlatformBitmapFactory, mTestExecutorService);
  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mock(Object.class),
          ImageRequest.RequestLevel.FULL_FETCH,
          false /* isPrefetch */,
          false /* isIntermediateResultExpected */,
          Priority.MEDIUM,
          mConfig);
  when(mImageRequest.getPostprocessor()).thenReturn(mPostprocessor);
  mResults = new ArrayList<>();
  when(mPostprocessor.getName()).thenReturn(POSTPROCESSOR_NAME);
  when(mProducerListener.requiresExtraMap(mProducerContext, POSTPROCESSOR_NAME)).thenReturn(true);
  doAnswer(
          new Answer<Object>() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
              mResults.add(
                  ((CloseableReference<CloseableImage>) invocation.getArguments()[0]).clone());
              return null;
            }
          })
      .when(mConsumer)
      .onNewResult(any(CloseableReference.class), anyInt());
  mInOrder = inOrder(mPostprocessor, mProducerListener, mConsumer);
}
 
Example 14
Source File: FrescoPlusFetcher.java    From FrescoPlus with Apache License 2.0 4 votes vote down vote up
/**
 * @param frescoPlusView The draweeView is to display the bitmap
 * @param uri         The source uri
 * @param callback    Listening to the success or failure
 */
private void fetchImage(FrescoPlusView frescoPlusView, Uri uri, FPFetchCallback<ImageInfo> callback) {
    GenericDraweeHierarchyBuilder hierarchyBuilder = new GenericDraweeHierarchyBuilder(null);
    hierarchyBuilder.setFadeDuration(fadeDuration);
    hierarchyBuilder.setRoundingParams(RoundingParams.fromCornersRadius(radius));
    hierarchyBuilder.setActualImageScaleType(scaleType);
    if (defaultDrawable != null)
        hierarchyBuilder.setPlaceholderImage(defaultDrawable, scaleType);
    if (pressedDrawable != null)
        hierarchyBuilder.setPressedStateOverlay(pressedDrawable);
    if (retryDrawable != null)
        hierarchyBuilder.setRetryImage(retryDrawable);
    if (overlayDrawable != null)
        hierarchyBuilder.setOverlay(overlayDrawable);
    if (failureDrawable != null)
        hierarchyBuilder.setFailureImage(failureDrawable, scaleType);
    if (progressDrawable != null)
        hierarchyBuilder.setProgressBarImage(progressDrawable);
    GenericDraweeHierarchy hierarchy = hierarchyBuilder.build();

    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);
    requestBuilder.setLowestPermittedRequestLevel(requestLevel);
    requestBuilder.setAutoRotateEnabled(autoRotateEnabled);
    if (postprocessor != null)
        requestBuilder.setPostprocessor(postprocessor);
    Priority priority = requestPriority == FrescoPriority.HIGH ? Priority.HIGH : Priority.MEDIUM;
    requestBuilder.setRequestPriority(priority);
    if (resizeWidth > 0 && resizeHeight > 0)
        requestBuilder.setResizeOptions(new ResizeOptions(resizeWidth, resizeHeight));
    ImageRequest imageRequest = requestBuilder.build();

    DraweeController draweeController = FrescoPlusCore.newDraweeControllerBuilder()
            .setOldController(frescoPlusView.getController())
            .setAutoPlayAnimations(true)
            .setRetainImageOnFailure(true)
            .setTapToRetryEnabled(true)
            .setImageRequest(imageRequest)
            .setControllerListener(FetchImageControllerListenerSupplier.newInstance(callback))
            .build();
    frescoPlusView.setHierarchy(hierarchy);
    frescoPlusView.setController(draweeController);
}
 
Example 15
Source File: DiskCacheWriteProducerTest.java    From fresco with MIT License 4 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mDiskCacheWriteProducer =
      new DiskCacheWriteProducer(
          mDefaultBufferedDiskCache,
          mSmallImageBufferedDiskCache,
          mCacheKeyFactory,
          mInputProducer);
  List<CacheKey> keys = new ArrayList<>(1);
  keys.add(new SimpleCacheKey("http://dummy.uri"));
  mCacheKey = new MultiCacheKey(keys);
  mIntermediatePooledByteBuffer = mock(PooledByteBuffer.class);
  mFinalPooledByteBuffer = mock(PooledByteBuffer.class);
  mIntermediateImageReference = CloseableReference.of(mIntermediatePooledByteBuffer);
  mFinalImageReference = CloseableReference.of(mFinalPooledByteBuffer);
  mIntermediateEncodedImage = new EncodedImage(mIntermediateImageReference);
  mFinalEncodedImageFormatUnknown = new EncodedImage(mFinalImageReference);

  mFinalEncodedImage = new EncodedImage(mFinalImageReference);
  mFinalEncodedImage.setImageFormat(new ImageFormat("jpeg", null));
  mFinalEncodedImage.setWidth(100);
  mFinalEncodedImage.setHeight(100);

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mLowestLevelProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.DISK_CACHE,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mProducerListener.requiresExtraMap(mProducerContext, PRODUCER_NAME)).thenReturn(true);
  when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, mCallerContext)).thenReturn(mCacheKey);
  when(mImageRequest.getCacheChoice()).thenReturn(ImageRequest.CacheChoice.DEFAULT);
  when(mImageRequest.isDiskCacheEnabled()).thenReturn(true);
}
 
Example 16
Source File: DiskCacheReadProducerTest.java    From fresco with MIT License 4 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mDiskCacheReadProducer =
      new DiskCacheReadProducer(
          mDefaultBufferedDiskCache,
          mSmallImageBufferedDiskCache,
          mCacheKeyFactory,
          mInputProducer);
  List<CacheKey> keys = new ArrayList<>(1);
  keys.add(new SimpleCacheKey("http://dummy.uri"));
  mCacheKey = new MultiCacheKey(keys);
  mIntermediatePooledByteBuffer = mock(PooledByteBuffer.class);
  mFinalPooledByteBuffer = mock(PooledByteBuffer.class);
  mIntermediateImageReference = CloseableReference.of(mIntermediatePooledByteBuffer);
  mFinalImageReference = CloseableReference.of(mFinalPooledByteBuffer);
  mIntermediateEncodedImage = new EncodedImage(mIntermediateImageReference);
  mFinalEncodedImage = new EncodedImage(mFinalImageReference);
  mIsCancelled = ArgumentCaptor.forClass(AtomicBoolean.class);

  mProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mLowestLevelProducerContext =
      new SettableProducerContext(
          mImageRequest,
          mRequestId,
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.DISK_CACHE,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  when(mProducerListener.requiresExtraMap(mProducerContext, PRODUCER_NAME)).thenReturn(true);
  when(mCacheKeyFactory.getEncodedCacheKey(mImageRequest, mCallerContext)).thenReturn(mCacheKey);
  when(mImageRequest.getCacheChoice()).thenReturn(ImageRequest.CacheChoice.DEFAULT);
  when(mImageRequest.isDiskCacheEnabled()).thenReturn(true);
}
 
Example 17
Source File: MultiplexProducerTest.java    From fresco with MIT License 4 votes vote down vote up
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);
  mMultiplexProducer =
      new BitmapMemoryCacheKeyMultiplexProducer(mCacheKeyFactory, mInputProducer);
  mImageRequest1 = mock(ImageRequest.class);
  mImageRequest2 = mock(ImageRequest.class);
  mProducerContext1 =
      new SettableProducerContext(
          mImageRequest1,
          "id1",
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mProducerContext2 =
      new SettableProducerContext(
          mImageRequest1,
          "id2",
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mProducerContext3 =
      new SettableProducerContext(
          mImageRequest2,
          "id3",
          mProducerListener,
          mCallerContext,
          ImageRequest.RequestLevel.FULL_FETCH,
          false,
          true,
          Priority.MEDIUM,
          mConfig);
  mBitmapMemoryCacheKey1 = mock(BitmapMemoryCacheKey.class);
  mBitmapMemoryCacheKey2 = mock(BitmapMemoryCacheKey.class);
  mConsumer1 = mock(Consumer.class);
  mConsumer2 = mock(Consumer.class);
  mConsumer3 = mock(Consumer.class);
  mFinalCloseableImage1 = mock(CloseableImage.class);
  mFinalCloseableImage2 = mock(CloseableImage.class);
  mIntermediateCloseableImage1 = mock(CloseableImage.class);
  mIntermediateCloseableImage2 = mock(CloseableImage.class);
  mFinalImageReference1 = CloseableReference.of(mFinalCloseableImage1);
  mFinalImageReference2 = CloseableReference.of(mFinalCloseableImage2);
  mIntermediateImageReference1 = CloseableReference.of(mIntermediateCloseableImage1);
  mIntermediateImageReference2 = CloseableReference.of(mIntermediateCloseableImage2);

  when(mCacheKeyFactory.getBitmapCacheKey(mImageRequest1, mCallerContext))
      .thenReturn(mBitmapMemoryCacheKey1);
  when(mCacheKeyFactory.getBitmapCacheKey(mImageRequest2, mCallerContext))
      .thenReturn(mBitmapMemoryCacheKey2);

  doAnswer(
          new Answer() {
            @Override
            public Void answer(InvocationOnMock invocation) throws Throwable {
              if (mForwardingConsumer1 == null) {
                mForwardingConsumer1 = (Consumer) invocation.getArguments()[0];
                mMultiplexedContext1 = (BaseProducerContext) invocation.getArguments()[1];
              } else {
                mForwardingConsumer2 = (Consumer) invocation.getArguments()[0];
                mMultiplexedContext2 = (BaseProducerContext) invocation.getArguments()[1];
              }
              return null;
            }
          })
      .when(mInputProducer)
      .produceResults(any(Consumer.class), any(ProducerContext.class));
}