Skip to content

Instantly share code, notes, and snippets.

@burythehammer
Last active March 30, 2017 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burythehammer/306beeb9138cf5d35a4b861c033dc563 to your computer and use it in GitHub Desktop.
Save burythehammer/306beeb9138cf5d35a4b861c033dc563 to your computer and use it in GitHub Desktop.
ScalaTest unit test examples for spark and cassandra
feature("Calculating current balances") {
scenario("Positive transactions") {
Given("a cassandra table with only positive transactions")
val cassandraRDD = buildMockCassandraRDD(positiveTransactionsFilePath)
When("I calculate users' balance")
val results = CalculateCurrentBalance.calculateCustomerBalances(cassandraRDD).collect()
Then("all balances should be positive")
every(results.map { case ((_, _), amount) => amount }) should be > 0
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment