public static void stubSetAlpha(final Drawable drawable) {
    final AtomicInteger atomicInteger = new AtomicInteger(255);
    doAnswer(
            new Answer<Void>() {
              @Override
              public Void answer(InvocationOnMock invocation) throws Throwable {
                Integer alpha = (Integer) invocation.getArguments()[0];
                drawable.invalidateSelf();
                atomicInteger.set(alpha);
                return null;
              }
            })
        .when(drawable)
        .setAlpha(anyInt());
  }
Stubs setAlpha method.

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