This example connects to the Cassandra Cluster, creates a keyspaces and asserts that is has been created.
Building CqlSession inside_block:cassandra
!!! warning
All methods returning instances of the Cassandra Driver's Cluster object in CassandraContainer have been deprecated. Providing these methods unnecessarily couples the Container to the Driver and creates potential breaking changes if the driver is updated.
Add the following dependency to your pom.xml/build.gradle file:
=== "Gradle"
groovy testImplementation "org.testcontainers:cassandra:{{latest_version}}"
=== "Maven"
xml <dependency> <groupId>org.testcontainers</groupId> <artifactId>cassandra</artifactId> <version>{{latest_version}}</version> <scope>test</scope> </dependency>