Specification – alternate players

Do you remember the turn that we hard coded to be always 1? Let's fix that behavior.

We can invoke the play method twice and verify that the turn changes from 1 to 2:

@Test 
public void whenPlayInvokedMultipleTimesThenTurnIncreases() {
  TicTacToeBean move1 = new TicTacToeBean(1, 1, 1, 'X'); 
  ticTacToe.play(move1.getX(), move1.getY()); 
  verify(collection, times(1)).saveMove(move1);
TicTacToeBean move2 = new TicTacToeBean(2, 1, 2, 'O'); ticTacToe.play(move2.getX(), move2.getY()); verify(collection, times(1)).saveMove(move2); }
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.116.51