@Override
    protected DataSource createDataSource() throws Exception {
        final PGSimpleDataSource datasource = new PGSimpleDataSource();

        datasource.setServerNames(new String[]{hostname});

        if (port != null) {
            datasource.setPortNumbers(new int[]{port});
        }

        datasource.setUser(username);
        datasource.setPassword(password);

        datasource.setDatabaseName(database);
        datasource.setApplicationName(this.getClass().getSimpleName());

        return datasource;

    }
Jdbi external PostgreSQL JUnit 5 rule. This class should not be used directly but through {@link JdbiExtension#externalPostgres(String, Integer, String, String, String)}.
<br>
This class is public with a protected constructor to allow special case construction.

<pre>{@code
    @RegisterExtension
    public JdbiExtension extension = new JdbiExternalPostgresExtension(...) {
        @Override
        protected DataSource createDataSource() {
           ...
        }
    };
}</pre>
testing/src/main/java/org/jdbi/v3/testing/junit5/JdbiExternalPostgresExtension.java