@Test
 public void testRightLetterPressedWithOneItemInAnswer() {
   when(mockStore.state())
       .thenReturn(
           createState("test", singletonList(new Letter(TOP, 'e')), singletonList("test"), 0, 1L));
   actionCreator.rightLetterPressed();
   verifySingleActionDispatched(Action.RightPressed.INSTANCE);
 }
 @Test
 public void testRightLetterPressedWithEmptyAnswer() {
   when(mockStore.state())
       .thenReturn(
           createState("test", Collections.<Letter>emptyList(), singletonList("test"), 0, 1L));
   actionCreator.rightLetterPressed();
   verifySingleActionDispatched(Action.RightPressed.INSTANCE);
 }
  @Test
  public void testBonusTimeFullForRightLetterPressedWithCorrectAnswer() {
    when(mockStore.state())
        .thenReturn(createState("test", toListOfLetters("test"), singletonList("test"), 0, 1L));
    actionCreator.rightLetterPressed();

    ArgumentCaptor<Action> actionCaptor = ArgumentCaptor.forClass(Action.class);
    verify(mockStore, times(2)).dispatch(actionCaptor.capture());

    List<Action> capturedActions = actionCaptor.getAllValues();

    Action.NextGame nextGameAction = (Action.NextGame) capturedActions.get(1);
    assertEquals(nextGameAction.getBonusTime(), ActionCreator.TIME_BONUS);
  }
  @Test
  public void testRightLetterPressedWithIncorrectAnswer() {
    when(mockStore.state())
        .thenReturn(createState("test", toListOfLetters("estt"), singletonList("test"), 0, 1L));
    actionCreator.rightLetterPressed();

    ArgumentCaptor<Action> actionCaptor = ArgumentCaptor.forClass(Action.class);
    verify(mockStore, times(2)).dispatch(actionCaptor.capture());

    List<Action> capturedActions = actionCaptor.getAllValues();

    assertEquals(capturedActions.get(0), Action.RightPressed.INSTANCE);
    assertTrue(capturedActions.get(1) instanceof Action.ResetGame);
  }
  @Test
  public void testRightLetterPressedWithCorrectAnswerAndErrorOccurs() {
    when(mockRepository.getRandomWord()).thenReturn(Observable.<Word>error(new Exception()));
    when(mockStore.state())
        .thenReturn(createState("test", toListOfLetters("test"), singletonList("test"), 0, 1L));

    actionCreator.rightLetterPressed();

    ArgumentCaptor<Action> actionCaptor = ArgumentCaptor.forClass(Action.class);
    verify(mockStore, times(3)).dispatch(actionCaptor.capture());

    List<Action> capturedActions = actionCaptor.getAllValues();

    assertEquals(capturedActions.get(0), Action.RightPressed.INSTANCE);
    assertEquals(capturedActions.get(1), Action.Back.INSTANCE);
    assertEquals(capturedActions.get(2), Action.LoadWordError.INSTANCE);
  }