@Override
    public String getUrl() {
        final EmbeddedPostgres pg = this.epg;
        if (pg == null) {
            throw new IllegalStateException("not within a Junit test!");
        }

        return pg.getJdbcUrl("postgres");
    }
Jdbi PostgreSQL JUnit 5 rule using the otj-pg-embedded component.

Override methods for special case construction:

<pre>{@code
    @RegisterExtension
    public JdbiExtension extension = new JdbiOtjPostgresExtension() {
        @Override
        protected DataSource createDataSource() {
           ...
        }
    };
}</pre>

Use with {@link org.junit.jupiter.api.extension.ExtendWith}:

<pre>{@code
@ExtendWith(JdbiOtjPostgresExtension.class)
public class DatabaseTest {
    @Test
    public void testWithJdbi(Jdbi jdbi) {
        ...
    }

    @Test
    public void testWithHandle(Handle handle) {
        ...
    }
}
}</pre>
testing/src/main/java/org/jdbi/v3/testing/junit5/JdbiOtjPostgresExtension.java