@Nullable
  public static ControllerListener stubControllerListener(final DraweeController controller) {
    final ForwardingControllerListener forwardingListener = new ForwardingControllerListener();
    if (!(controller instanceof AbstractDraweeController)) {
      return null;
    }
    AbstractDraweeController abstractController = (AbstractDraweeController) controller;
    doAnswer(
            new Answer() {
              @Override
              public Object answer(InvocationOnMock invocation) throws Throwable {
                forwardingListener.addListener((ControllerListener) invocation.getArguments()[0]);
                // NULLSAFE_FIXME[Return Not Nullable]
                return null;
              }
            })
        .when(abstractController)
        // NULLSAFE_FIXME[Not Vetted Third-Party]
        .addControllerListener(any(ControllerListener.class));
    return forwardingListener;
  }
Stubs addControllerListener

@param controller
@return forwarding listener
drawee/src/test/java/com/facebook/drawee/testing/DraweeMocks.java