Integration Testing in Wordz
Explore how to write and understand integration tests for a Java application using the Wordz example. Learn to set up test data with database-rider, connect to Postgres, and verify database interactions to ensure reliable code integration.
We'll cover the following...
In this lesson, we’ll review an integration test for our Wordz application to get a feel for what they look like.
Fetching a word from the database
As part of our earlier design work, we identified that Wordz would need a place to store the candidate words to be guessed. We defined an interface called WordRepository to isolate us from the details of storage. At that iteration, we had only got as far as defining one method on the interface:
The implementation of this WordRepository interface will access the database and return a word given its wordNumber. We’ll defer implementing this to Chapter 15, Driving the Database Layer. For now, let’s take an early look at what the ...