@Test
    public void testAuthenticationEnabled() {
        String role = "random";
        try (
            final YugabyteDBYCQLContainer ycqlContainer = new YugabyteDBYCQLContainer(YBDB_TEST_IMAGE)
                .withUsername(role)
                .withPassword(role)
        ) {
            ycqlContainer.start();
            assertThat(
                performQuery(ycqlContainer, "SELECT role FROM system_auth.roles where role='" + role + "'")
                    .one()
                    .getString(0)
            )
                .as("Keyspace login with authentication enabled succeeds")
                .isEqualTo(role);
        }
    }
YugabyteDB YCQL API unit test class
modules/yugabytedb/src/test/java/org/testcontainers/junit/yugabytedb/YugabyteDBYCQLTest.java