@Test
    public void testCustomDatabase() throws SQLException {
        String key = "random";
        try (
            final YugabyteDBYSQLContainer ysqlContainer = new YugabyteDBYSQLContainer(YBDB_TEST_IMAGE)
                .withDatabaseName(key)
        ) {
            ysqlContainer.start();
            assertThat(performQuery(ysqlContainer, "SELECT 1").getInt(1))
                .as("A test query on a custom database succeeds")
                .isEqualTo(1);
        }
    }
YugabyteDB YSQL API unit test class
modules/yugabytedb/src/test/java/org/testcontainers/junit/yugabytedb/YugabyteDBYSQLTest.java