Wordz – integration test for our database
In this section, we’ll review an integration test for our Wordz application to get a feel for what they look like. We’ll cover the details of writing these tests and setting up the test tools in Chapter 14, Driving the Database Layer, and Chapter 15, Driving the Web Layer.
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:
public interface WordRepository { String fetchWordByNumber( int wordNumber ); }
The implementation of this WordRepository interface will access the database and return a word given its wordNumber
. We will defer implementing this to Chapter 14, Driving the Database Layer. For now, let’s take an early look at what...