O'Reilly logo

Test-Driven Java Development - Second Edition by Viktor Farcic, Alex Garcia

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Specification – clear state between games

This is a very simple application that, at least at this moment, can store only one game session. Whenever a new instance is created, we should start over and remove all data stored in the database. The easiest way to do this is to simply drop the MongoDB collection. Jongo has the MongoCollection.drop() method that can be used for that. We'll create a new method, drop, that will act in a similar way to saveMove.

If you haven't worked with Mockito, MongoDB, and/or Jongo, the chances are you were not able to do the exercises from this chapter by yourself, and just decided to follow the solutions we provided. If that's the case, this is the moment when you may want to switch gears and try to write the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required