Production Code for Database Integration Test

Let's drive the production code continuing the database integration test creation.

The next job is to add the missing Arrange, Act, and Assert code to the fetchesWord() test.

Driving out the production code

Our goal is to test-drive code to fetch a word from the database. We want that code to be in a class that implements the WordRepository interface, which we defined in the domain model. We will want to design enough of our database schema to support this. By starting to add code to the Assert step, we can drive out an implementation quickly. This is a useful technique – writing the test by starting with the assert, so that we start with the desired outcome. We can then work backward to include everything necessary for delivering it:

  • Add the Assert step to our fetchesWord() test:

Get hands-on with 1200+ tech skills courses.