Class TestcontainersDatabaseInformation

java.lang.Object
org.jdbi.v3.testing.junit5.tc.TestcontainersDatabaseInformation

@Beta public final class TestcontainersDatabaseInformation extends Object
Describes the parameters needed to create a new test-specific database or schema to isolate a test. Testcontainers supports many different databases and the Jdbi specific extension requires parameterization.

The Testcontainers project provides a convenient way to spin up dependencies as containers and offers a Java API to access these instances. Jdbi can use these instances for testing and offers the same functionality as the builtin support for PostgreSQL, H2 and Sqlite.

As every database engine is slightly different and supports different features, there is some "glue" needed, which is specific to the testcontainer class. Out of the box, Jdbi works with the testcontainer support for MySQL, MariaDB, TiDB, PostgreSQL (inclusive PostGIS), CockroachDB, YugabyteDB, ClickhouseDB, Oracle XE, Oracle Free, TrinoDB and MSSQL Server.
Any of the testcontainer instances for these databases, can be used with JdbiTestcontainersExtension.instance(JdbcDatabaseContainer) to create a JUnit 5 Extension instance that will manage database and schema instances for tests.

If a testcontainer class is not supported by Jdbi or the current Jdbi behavior does not match what is required for a test (e.g. schema or user creation), a custom TestcontainersDatabaseInformation instance can be created using the of(String, String, String, BiFunction) method.
This instance can be passed into the JdbiTestcontainersExtension.instance(TestcontainersDatabaseInformation, JdbcDatabaseContainer) method to create a custom JUnit 5 Extension.