<NME> PostgreSQLContainer.java
<BEF> package org.testcontainers.containers;

import org.jetbrains.annotations.NotNull;
import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
import org.testcontainers.utility.DockerImageName;

    public static final String NAME = "postgresql";
    public static final String IMAGE = "postgres";
    public static final Integer POSTGRESQL_PORT = 5432;
    final String databaseName;
    final String username;
    final String password;

    public PostgreSQLContainer() {
        this(IMAGE + ":latest");
    }

    public PostgreSQLContainer(final String dockerImageName) {
        this(dockerImageName, "test", "test", "test");
    }

    public PostgreSQLContainer(
        final String dockerImageName,
        final String databaseName,
        final String username,
        final String password
    ) {
        super(dockerImageName);
        this.databaseName = databaseName;
        this.username = username;
        this.password = password;
    }

    @Override

    public static final Integer POSTGRESQL_PORT = 5432;

    static final String DEFAULT_USER = "test";

    static final String DEFAULT_PASSWORD = "test";

    private String databaseName = "test";

    private String username = "test";

    private String password = "test";

    private static final String FSYNC_OFF_OPTION = "fsync=off";

    /**
     * @deprecated use {@link #PostgreSQLContainer(DockerImageName)} or {@link #PostgreSQLContainer(String)} instead
     */
    @Deprecated
    public PostgreSQLContainer() {
        this(DEFAULT_IMAGE_NAME.withTag(DEFAULT_TAG));
    }

    public PostgreSQLContainer(final String dockerImageName) {
        this(DockerImageName.parse(dockerImageName));
    }

    public PostgreSQLContainer(final DockerImageName dockerImageName) {
        super(dockerImageName);
        dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);

        this.waitStrategy =
            new LogMessageWaitStrategy()
                .withRegEx(".*database system is ready to accept connections.*\\s")
                .withTimes(2)
    public String getTestQueryString() {
        return "SELECT 1";
    }
}
        // Disable Postgres driver use of java.util.logging to reduce noise at startup time
        withUrlParam("loggerLevel", "OFF");
        addEnv("POSTGRES_DB", databaseName);
        addEnv("POSTGRES_USER", username);
        addEnv("POSTGRES_PASSWORD", password);
    }

    @Override
    public String getDriverClassName() {
        return "org.postgresql.Driver";
    }

    @Override
    public String getJdbcUrl() {
        String additionalUrlParams = constructUrlParameters("?", "&");
        return (
            "jdbc:postgresql://" +
            getHost() +
            ":" +
            getMappedPort(POSTGRESQL_PORT) +
            "/" +
            databaseName +
            additionalUrlParams
        );
    }

    @Override
    public String getDatabaseName() {
        return databaseName;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getTestQueryString() {
        return "SELECT 1";
    }

    @Override
    public SELF withDatabaseName(final String databaseName) {
        this.databaseName = databaseName;
        return self();
    }

    @Override
    public SELF withUsername(final String username) {
        this.username = username;
        return self();
    }

    @Override
    public SELF withPassword(final String password) {
        this.password = password;
        return self();
    }

    @Override
    protected void waitUntilContainerStarted() {
        getWaitStrategy().waitUntilReady(this);
    }
}

<MSG> Switch to fluent API

<DFF> @@ -7,28 +7,16 @@ public class PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends
     public static final String NAME = "postgresql";
     public static final String IMAGE = "postgres";
     public static final Integer POSTGRESQL_PORT = 5432;
-    final String databaseName;
-    final String username;
-    final String password;
+    private String databaseName = "test";
+    private String username = "test";
+    private String password = "test";
 
     public PostgreSQLContainer() {
         this(IMAGE + ":latest");
     }
 
     public PostgreSQLContainer(final String dockerImageName) {
-        this(dockerImageName, "test", "test", "test");
-    }
-
-    public PostgreSQLContainer(
-        final String dockerImageName,
-        final String databaseName,
-        final String username,
-        final String password
-    ) {
         super(dockerImageName);
-        this.databaseName = databaseName;
-        this.username = username;
-        this.password = password;
     }
 
     @Override
@@ -70,4 +58,19 @@ public class PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends
     public String getTestQueryString() {
         return "SELECT 1";
     }
+
+    public SELF withDatabaseName(final String databaseName) {
+        this.databaseName = databaseName;
+        return self();
+    }
+
+    public SELF withUsername(final String username) {
+        this.username = username;
+        return self();
+    }
+
+    public SELF withPassword(final String password) {
+        this.password = password;
+        return self();
+    }
 }

{'commit': 'diff --git a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java\nindex 526fe07f..725f73d6 100644\n--- a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java\n+++ b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java\n@@ -7,28 +7,16 @@ public class PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends\n     public static final String NAME = "postgresql";\n     public static final String IMAGE = "postgres";\n     public static final Integer POSTGRESQL_PORT = 5432;\n-    final String databaseName;\n-    final String username;\n-    final String password;\n+    private String databaseName = "test";\n+    private String username = "test";\n+    private String password = "test";\n \n     public PostgreSQLContainer() {\n         this(IMAGE + ":latest");\n     }\n \n     public PostgreSQLContainer(final String dockerImageName) {\n-        this(dockerImageName, "test", "test", "test");\n-    }\n-\n-    public PostgreSQLContainer(\n-        final String dockerImageName,\n-        final String databaseName,\n-        final String username,\n-        final String password\n-    ) {\n         super(dockerImageName);\n-        this.databaseName = databaseName;\n-        this.username = username;\n-        this.password = password;\n     }\n \n     @Override\n@@ -70,4 +58,19 @@ public class PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends\n     public String getTestQueryString() {\n         return "SELECT 1";\n     }\n+\n+    public SELF withDatabaseName(final String databaseName) {\n+        this.databaseName = databaseName;\n+        return self();\n+    }\n+\n+    public SELF withUsername(final String username) {\n+        this.username = username;\n+        return self();\n+    }\n+\n+    public SELF withPassword(final String password) {\n+        this.password = password;\n+        return self();\n+    }\n }\ndiff --git a/modules/postgresql/src/test/java/org/testcontainers/junit/CustomizablePostgreSQLTest.java b/modules/postgresql/src/test/java/org/testcontainers/junit/CustomizablePostgreSQLTest.java\nindex 6b9dc8a5..8180ae2a 100644\n--- a/modules/postgresql/src/test/java/org/testcontainers/junit/CustomizablePostgreSQLTest.java\n+++ b/modules/postgresql/src/test/java/org/testcontainers/junit/CustomizablePostgreSQLTest.java\n@@ -21,8 +21,10 @@ public class CustomizablePostgreSQLTest {\n     private static final String PWD = "baz";\n \n     @Rule\n-    public PostgreSQLContainer postgres = new PostgreSQLContainer(\n-        "postgres:latest", DB_NAME, USER, PWD);\n+    public PostgreSQLContainer postgres = new PostgreSQLContainer("postgres:latest")\n+        .withDatabaseName(DB_NAME)\n+        .withUsername(USER)\n+        .withPassword(PWD);\n \n     @Test\n     public void testSimple() throws SQLException {\n', 'commit_subject': 'Switch to fluent API', 'repo_name': 'testcontainers/testcontainers-java', 'committer': {'name': 'Barlog', 'email': 'fb624ce2036e2afa2097e82fccf2901a02d3ac76@tanelorn.li', 'time_sec': '1473709196', 'tz_offset': '180', 'date': {'seconds': '1473709196'}}, 'commit_tree': '8f0830e84f069e2aeb41ea4996d7fadaad37648a', 'commit_message': 'Switch to fluent API\n', 'language_name': 'HTML', 'license': 'mit', 'hunks': '@@ -7,28 +7,16 @@ public class PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends\n     public static final String NAME = "postgresql";\n     public static final String IMAGE = "postgres";\n     public static final Integer POSTGRESQL_PORT = 5432;\n-    final String databaseName;\n-    final String username;\n-    final String password;\n+    private String databaseName = "test";\n+    private String username = "test";\n+    private String password = "test";\n \n     public PostgreSQLContainer() {\n         this(IMAGE + ":latest");\n     }\n \n     public PostgreSQLContainer(final String dockerImageName) {\n-        this(dockerImageName, "test", "test", "test");\n-    }\n-\n-    public PostgreSQLContainer(\n-        final String dockerImageName,\n-        final String databaseName,\n-        final String username,\n-        final String password\n-    ) {\n         super(dockerImageName);\n-        this.databaseName = databaseName;\n-        this.username = username;\n-        this.password = password;\n     }\n \n     @Override\n@@ -70,4 +58,19 @@ public class PostgreSQLContainer<SELF extends PostgreSQLContainer<SELF>> extends\n     public String getTestQueryString() {\n         return "SELECT 1";\n     }\n+\n+    public SELF withDatabaseName(final String databaseName) {\n+        this.databaseName = databaseName;\n+        return self();\n+    }\n+\n+    public SELF withUsername(final String username) {\n+        this.username = username;\n+        return self();\n+    }\n+\n+    public SELF withPassword(final String password) {\n+        this.password = password;\n+        return self();\n+    }\n }\n', 'addition_count': 18, 'deletion_count': 15, 'src_file': 'a/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java', 'tgt_file': 'b/modules/postgresql/src/main/java/org/testcontainers/containers/PostgreSQLContainer.java', 'file_extension': '.java', 'before_file': 'package org.testcontainers.containers;\n\nimport org.jetbrains.annotations.NotNull;\nimport org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;\nimport org.testcontainers.utility.DockerImageName;\n\n    public static final String NAME = "postgresql";\n    public static final String IMAGE = "postgres";\n    public static final Integer POSTGRESQL_PORT = 5432;\n    final String databaseName;\n    final String username;\n    final String password;\n\n    public PostgreSQLContainer() {\n        this(IMAGE + ":latest");\n    }\n\n    public PostgreSQLContainer(final String dockerImageName) {\n        this(dockerImageName, "test", "test", "test");\n    }\n\n    public PostgreSQLContainer(\n        final String dockerImageName,\n        final String databaseName,\n        final String username,\n        final String password\n    ) {\n        super(dockerImageName);\n        this.databaseName = databaseName;\n        this.username = username;\n        this.password = password;\n    }\n\n    @Override\n\n    public static final Integer POSTGRESQL_PORT = 5432;\n\n    static final String DEFAULT_USER = "test";\n\n    static final String DEFAULT_PASSWORD = "test";\n\n    private String databaseName = "test";\n\n    private String username = "test";\n\n    private String password = "test";\n\n    private static final String FSYNC_OFF_OPTION = "fsync=off";\n\n    /**\n     * @deprecated use {@link #PostgreSQLContainer(DockerImageName)} or {@link #PostgreSQLContainer(String)} instead\n     */\n    @Deprecated\n    public PostgreSQLContainer() {\n        this(DEFAULT_IMAGE_NAME.withTag(DEFAULT_TAG));\n    }\n\n    public PostgreSQLContainer(final String dockerImageName) {\n        this(DockerImageName.parse(dockerImageName));\n    }\n\n    public PostgreSQLContainer(final DockerImageName dockerImageName) {\n        super(dockerImageName);\n        dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);\n\n        this.waitStrategy =\n            new LogMessageWaitStrategy()\n                .withRegEx(".*database system is ready to accept connections.*\\\\s")\n                .withTimes(2)\n    public String getTestQueryString() {\n        return "SELECT 1";\n    }\n}\n        // Disable Postgres driver use of java.util.logging to reduce noise at startup time\n        withUrlParam("loggerLevel", "OFF");\n        addEnv("POSTGRES_DB", databaseName);\n        addEnv("POSTGRES_USER", username);\n        addEnv("POSTGRES_PASSWORD", password);\n    }\n\n    @Override\n    public String getDriverClassName() {\n        return "org.postgresql.Driver";\n    }\n\n    @Override\n    public String getJdbcUrl() {\n        String additionalUrlParams = constructUrlParameters("?", "&");\n        return (\n            "jdbc:postgresql://" +\n            getHost() +\n            ":" +\n            getMappedPort(POSTGRESQL_PORT) +\n            "/" +\n            databaseName +\n            additionalUrlParams\n        );\n    }\n\n    @Override\n    public String getDatabaseName() {\n        return databaseName;\n    }\n\n    @Override\n    public String getUsername() {\n        return username;\n    }\n\n    @Override\n    public String getPassword() {\n        return password;\n    }\n\n    @Override\n    public String getTestQueryString() {\n        return "SELECT 1";\n    }\n\n    @Override\n    public SELF withDatabaseName(final String databaseName) {\n        this.databaseName = databaseName;\n        return self();\n    }\n\n    @Override\n    public SELF withUsername(final String username) {\n        this.username = username;\n        return self();\n    }\n\n    @Override\n    public SELF withPassword(final String password) {\n        this.password = password;\n        return self();\n    }\n\n    @Override\n    protected void waitUntilContainerStarted() {\n        getWaitStrategy().waitUntilReady(this);\n    }\n}\n', 'message': 'Switch to fluent API\n', 'author_name': 'Barlog', 'lang': 'java'}