Skip to content
Fresh

Run tests

Back

Guides

Working with jOOQ and Flyway using Testcontainers

Generate typesafe jOOQ code from a real PostgreSQL database managed by Flyway migrations, then test repositories using Testcontainers.

Java Testing with Docker

25 minutes

1

Create the project

2

Write tests

3

Run tests

« Back to all guides

Run tests and next steps

Copy as Markdown

Open MarkdownAsk Docs AIClaudeOpen in Claude

Table of contents


Run the tests

console
$ ./mvnw test

You should see the PostgreSQL Docker container start, jOOQ code generation complete, and all tests pass. After the tests finish, the container stops and is removed automatically.

Summary

The Testcontainers library helps you generate Java code from the database using the jOOQ code generator and test your persistence layer against the same type of database (PostgreSQL) that you use in production, instead of mocks or in-memory databases.

Because the code is always generated from the database's current state, you can be confident that your code stays in sync with database changes. You're free to refactor and still verify that the application works as expected.

To learn more about Testcontainers, visit the Testcontainers overview.

Further reading