@TargetApi(11)
  public static void stubGetAndSetCallback(final Drawable drawable) {
    final AtomicReference<Drawable.Callback> callback = new AtomicReference<Drawable.Callback>();
    // NULLSAFE_FIXME[Parameter Not Nullable]
    when(drawable.getCallback()).thenReturn(callback.get());
    doAnswer(
            new Answer<Void>() {
              @Override
              public Void answer(InvocationOnMock invocation) throws Throwable {
                callback.set((Drawable.Callback) invocation.getArguments()[0]);
                return null;
              }
            })
        .when(drawable)
        .setCallback(any(Drawable.Callback.class));
    doAnswer(
            new Answer<Void>() {
              @Override
              public Void answer(InvocationOnMock invocation) throws Throwable {
                if (callback.get() != null) {
                  callback.get().invalidateDrawable(drawable);
                }
                return null;
              }
            })
        .when(drawable)
        .invalidateSelf();
  }
Stubs setCallback and getCallback methods.

@param drawable drawable to stub methods of
drawee/src/test/java/com/facebook/drawee/drawable/DrawableTestUtils.java