14

Driving the Database Layer

In this chapter, we will implement a database adapter for one of our ports in the domain model, represented by the WordRepository interface. This will allow our domain model to fetch words to guess from a real database, in this case, using the popular open source database Postgres. We will test-drive both the database setup and the code that accesses the database. To help us do that, we will use a test framework that is designed to simplify writing database integration tests, called DBRider.

By the end of the chapter, we will have written an integration test against a running database, implemented the fetchesWordByNumber() method from the WordRepository interface, and used the JDBI database access library to help ...

Get Test-Driven Development with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.