@Test
    public void testCustomKeyspace() {
        String key = "random";
        try (
            final YugabyteDBYCQLContainer ycqlContainer = new YugabyteDBYCQLContainer(YBDB_TEST_IMAGE)
                .withKeyspaceName(key)
                .withUsername("cassandra")
                .withPassword("cassandra")
        ) {
            ycqlContainer.start();
            assertThat(
                performQuery(
                    ycqlContainer,
                    "SELECT keyspace_name FROM system_schema.keyspaces where keyspace_name='" + key + "'"
                )
                    .one()
                    .getString(0)
            )
                .as("Custom keyspace creation succeeds")
                .isEqualTo(key);
        }
    }
YugabyteDB YCQL API unit test class
modules/yugabytedb/src/test/java/org/testcontainers/junit/yugabytedb/YugabyteDBYCQLTest.java