@Test
public void pushRetained_whenChildRouterSwitchesStateImmediately_shouldSwitchToCorrectState() {

  routerNavigator.pushRetainedState(TestState.STATE_1, attachTransitionOne, detachTransitionOne);
  verify(attachTransitionOne).willAttachToHost(routerOne, null, TestState.STATE_1, true);
  verify(hostRouter).attachChild(routerOne);
  verifyZeroInteractions(detachTransitionOne);
  Answer attachChildAnswer =
      new Answer() {
        @Override
        public Void answer(InvocationOnMock invocation) throws Throwable {
          routerNavigator.pushRetainedState(
              TestState.STATE_3, attachTransitionThree, detachTransitionThree);
          return null;
        }
      };
  doAnswer(attachChildAnswer).when(hostRouter).attachChild(routerTwo);
  routerNavigator.pushRetainedState(TestState.STATE_2, attachTransitionTwo, detachTransitionTwo);
  verify(detachTransitionOne)
      .willDetachFromHost(routerOne, TestState.STATE_1, TestState.STATE_2, true);
  verify(attachTransitionTwo)
      .willAttachToHost(routerTwo, TestState.STATE_1, TestState.STATE_2, true);
  verify(detachTransitionTwo)
      .willDetachFromHost(routerTwo, TestState.STATE_2, TestState.STATE_3, true);
  verify(attachTransitionThree)
      .willAttachToHost(routerThree, TestState.STATE_2, TestState.STATE_3, true);
  verify(attachTransitionThree, never())
      .willAttachToHost(routerThree, TestState.STATE_1, TestState.STATE_3, true);
}