Specification refactoring

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.

..................Content has been hidden....................

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