March 2018
Intermediate to advanced
324 pages
8h 30m
English
We should start by checking whether a piece is placed within the boundaries of the 3x3 board:
package com.packtpublishing.tddjava.ch03tictactoe;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
public class TicTacToeSpec {
@Rule
public ExpectedException exception = ExpectedException.none();
private TicTacToe ticTacToe;
@Before
public final void before() {
ticTacToe = new TicTacToe();
} @Test
public void whenXOutsideBoardThenRuntimeException() {
exception.expect(RuntimeException.class);
ticTacToe.play(5, 2);
}
}
In this test, we are defining that RuntimeException is ...
Read now
Unlock full access