This sample below shows you the code to test your embedded Cassandra to test the context load which involves testing:
- Your Cassandra Related Dependency Beans and Listeners associated with it.
- Test Embedded Cassandra
- Test Cassandra Dataset usually loaded in .sql file.
- Test classpath, ldap and any properties needed.
NOTE: This is just a context test for that particular instance being ran at that time. Passing this does not guarantee that it will behave the same in a different environments. This is just a basic level check to see if at least the coding side of things are correct.
@RunWith(SpringRunner.class)
@TestExecutionListeners(listeners = {
YourCassandraRelatedDependencyListeners.class})
@CassandraDataSet(value = {
"/setup.cql"}, keyspace = "your-defined-space")
@EmbeddedCassandra(timeout = 50000L)
@SpringBootTest(classes = {
YourApplication.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, properties = {
"spring.cloud.config.label=integration-test"})
@TestPropertySource(locations = {
"classpath:embeddedCassandra.properties",
"classpath:krypt.properties",
"classpath:ldap.properties"})
@Category(value = IntegrationTest.class)
public class YourApplicationIT
{
@Test
public void contextLoad()
{
}
}
Leave a Reply