To utilize a newly created TicTacToe constructor, we can do something such as the following:
private TicTacToeCollection collection; @Before public final void before() throws UnknownHostException { collection = mock(TicTacToeCollection.class); // ticTacToe = new TicTacToe(); ticTacToe = new TicTacToe(collection); }
Now all our specifications will use a mocked version of the TicTacToeCollection. There are other ways to inject mocked dependencies (for example, with Spring); however, when possible, we feel that simplicity trumps complicated frameworks.