Skip to content

Cassandra Module

Usage example

This example connects to the Cassandra Cluster, creates a keyspaces and asserts that is has been created.

CqlSession session = CqlSession
    .builder()
    .addContactPoint(this.cassandra.getContactPoint())
    .withLocalDatacenter(this.cassandra.getLocalDatacenter())
    .build()

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.

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

testImplementation "org.testcontainers:cassandra:1.19.7"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>cassandra</artifactId>
    <version>1.19.7</version>
    <scope>test</scope>
</dependency>