Database Integration Test with DBRider
Explore how to write database integration tests with DBRider and JUnit 5, connecting to a Postgres database. Understand setting up test users, databases, and implementing the WordRepository interface to drive database layer development.
We'll cover the following...
In this lesson, we’ll create the skeleton of a database integration test using a test framework called DBRider. We’ll use this test to drive out the creation of a database table and database user. We’ll be working towards implementing the WordRepository interface, which will access words stored in a Postgres database.
Skeleton of a database integration test
Previously, we created a domain model for our Wordz application, using hexagonal architecture to guide us. Instead of accessing a database directly, our domain model uses an abstraction, known as a port in hexagonal terminology. One such port is the WordRepository interface, which represents stored words for guessing.
Ports must always be implemented by adapters in hexagonal architecture. An adapter for the ...