Class JdbiOtjPostgresExtension

All Implemented Interfaces:
AfterAllCallback, AfterEachCallback, BeforeAllCallback, BeforeEachCallback, Extension, ParameterResolver

public class JdbiOtjPostgresExtension extends JdbiExtension
Jdbi PostgreSQL JUnit 5 rule using the otj-pg-embedded component. Override methods for special case construction:

     public JdbiExtension extension = new JdbiOtjPostgresExtension() {
         protected DataSource createDataSource() {
Use with ExtendWith:

 public class DatabaseTest {
     public void testWithJdbi(Jdbi jdbi) {

     public void testWithHandle(Handle handle) {
  • Constructor Details

    • JdbiOtjPostgresExtension

      public JdbiOtjPostgresExtension()
  • Method Details

    • getUrl

      public String getUrl()
      Description copied from class: JdbiExtension
      Returns a JDBC url representing the data source used by this extension. This url is database-specific and may or may not be used to connect to the data source outside testing code that uses this extension (e.g. the JdbiSqliteExtension returns a constant uri for all database instances).
      Specified by:
      getUrl in class JdbiExtension
      A string representing the JDBC URL.
    • customize

      public JdbiOtjPostgresExtension customize(Consumer<com.opentable.db.postgres.embedded.EmbeddedPostgres.Builder> customizer)