Last active
December 18, 2015 22:59
-
-
Save jsevellec/5858799 to your computer and use it in GitHub Desktop.
a cassandra-unit test example using CQL3 script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.cassandraunit.test.cql; | |
import com.datastax.driver.core.ResultSet; | |
import org.cassandraunit.CassandraCQLUnit; | |
import org.cassandraunit.dataset.cql.ClassPathCQLDataSet; | |
import org.junit.Rule; | |
import org.junit.Test; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.Matchers.is; | |
public class CQLScriptLoadTest { | |
@Rule | |
public CassandraCQLUnit cassandraCQLUnit = new CassandraCQLUnit( | |
new ClassPathCQLDataSet("simple.cql","keyspaceNameToCreate")); | |
@Test | |
public void should_have_started_and_execute_cql_script() throws Exception { | |
ResultSet result = cassandraCQLUnit.session.execute("select * from mytable WHERE id='myKey01'"); | |
assertThat(result.iterator().next().getString("value"), is("myValue01")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment