@Test
    public void testWithCustomRole() throws SQLException {
        try (
            final YugabyteDBYSQLContainer ysqlContainer = new YugabyteDBYSQLContainer(YBDB_TEST_IMAGE)
                .withDatabaseName("yugabyte")
                .withPassword("yugabyte")
                .withUsername("yugabyte")
        ) {
            ysqlContainer.start();
            assertThat(performQuery(ysqlContainer, "SELECT 1").getInt(1))
                .as("A sample test query with a custom role succeeds")
                .isEqualTo(1);
        }
    }
YugabyteDB YSQL API unit test class
modules/yugabytedb/src/test/java/org/testcontainers/junit/yugabytedb/YugabyteDBYSQLTest.java