March 2018
Intermediate to advanced
324 pages
8h 30m
English
To better understand the specification we just wrote, let us do only a partial implementation. We'll create an empty method, saveMove. This will allow our code to compile without implementing the specification yet:
public void saveMove(TicTacToeBean bean) {
}
When we run our specifications (gradle test), the result is the following:
Wanted but not invoked: mongoCollection.save(Turn: 3; X: 2; Y: 1; Player: Y);
Mockito tells us that, according to our specification, we expect the mongoCollection.save method to be invoked, and that the expectation was not fulfilled. Since the test is still failing, we need to go back and finish the implementation. One of the biggest sins in TDD is to have a failing test and move onto something ...
Read now
Unlock full access