package com.adaptionsoft.games.uglytrivia;

import org.junit.Test;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

public class GamePlayTest {

    @Test
    public void playerShouldAdvanceByEyesOfDice() {
        int eyesOfDice = 3;

        Players players = mock(Players.class);
        Questions questions = mock(Questions.class);
        Game game = GameBuilder.createGameWith(players, questions);

        game.playCurrentPlayer(eyesOfDice);

        verify(players).advanceBy(eyesOfDice);
    }

}

@@ -61,16 +61,198 @@
 .Test;%0A%0A
+import java.util.Arrays;%0Aimport java.util.List;%0A%0Aimport static org.hamcrest.CoreMatchers.hasItems;%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.mockito.Matchers.any;%0A
 import s
@@ -283,16 +283,16 @@
 o.mock;%0A
-
 import s
@@ -324,16 +324,56 @@
 .verify;
+%0Aimport static org.mockito.Mockito.when;
 %0A%0Apublic
@@ -696,24 +696,24 @@
 esOfDice);%0A%0A
-
         veri
@@ -754,10 +754,1200 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void playerShouldBeAskedQuestion() %7B%0A        new SystemOutCapture() %7B%0A            %7B%0A%0A                Players players = mock(Players.class);%0A                Questions questions = mock(Questions.class);%0A                when(questions.nextFor(any(Category.class))).thenReturn(%22Pop Question 1%22);%0A                Game game = GameBuilder.createGameWith(players, questions);%0A%0A                int anyEye = 0;%0A                game.playCurrentPlayer(anyEye);%0A%0A                assertThat(capturedSystemOutLines(), hasItems(%22Pop Question 1%22 ));%0A%0A            %7D%0A%0A            private List%3CString%3E capturedSystemOutLines() %7B%0A                return Arrays.asList(capturedSystemOut().split(cr()));%0A            %7D%0A        %7D.resetSystemOut();%0A    %7D%0A%0A    @Test%0A    public void playerShouldBeAskedQuestionBelongingToCategoryOfPlace() %7B%0A        Players players = mock(Players.class);%0A        when(players.currentCategory()).thenReturn(Category.POP);%0A        Questions questions = mock(Questions.class);%0A        Game game = GameBuilder.createGameWith(players, questions);%0A%0A        int anyEye = 7;%0A        game.playCurrentPlayer(anyEye);%0A%0A        verify(questions).nextFor(Category.POP);%0A    %7D%0A%0A
 %7D%0A

Test that player is asked a question and that question is of proper category