@Test
  public void testVisibilityStateTransitions() {
    boolean restart = true;

    // Initial state (mIsVisible, !mIsHolderAttached)
    mDraweeHolder.setController(mController);
    verifyControllerLifecycleCalls(0, 0);

    /** 1 */
    mDraweeHolder.onAttach();
    verifyControllerLifecycleCalls(1, 0);

    /** 2 */
    mTopLevelDrawable.setVisible(false, restart);
    verifyControllerLifecycleCalls(0, 1);

    /** 3 */
    mDraweeHolder.onDetach();
    verifyControllerLifecycleCalls(0, 0);

    /** 4 */
    mTopLevelDrawable.setVisible(true, restart);
    verifyControllerLifecycleCalls(0, 0);

    /** 5 */
    mTopLevelDrawable.setVisible(false, restart);
    verifyControllerLifecycleCalls(0, 0);

    /** 6 */
    mDraweeHolder.onAttach();
    verifyControllerLifecycleCalls(0, 0);

    /** 7 */
    mTopLevelDrawable.setVisible(true, restart);
    verifyControllerLifecycleCalls(1, 0);

    /** 8 */
    mDraweeHolder.onDetach();
    verifyControllerLifecycleCalls(0, 1);
  }
There are 8 possible state transitions with two variables 1. (visible, unattached) -> (visible,
attached) 2. (visible, attached) -> (invisible, attached) 3. (invisible, attached) ->
(invisible, unattached) 4. (invisible, unattached) -> (visible, unattached) 5. (visible,
unattached) -> (invisible, unattached) 6. (invisible, unattached) -> (invisible, attached) 7.
(invisible, attached) -> (visible, attached) 8. (visible, attached) -> (visible, unattached)
drawee/src/test/java/com/facebook/drawee/view/DraweeHolderTest.java