Skip to content

Instantly share code, notes, and snippets.

@chbatey
Created February 6, 2014 22:36
Show Gist options
  • Save chbatey/8853910 to your computer and use it in GitHub Desktop.
Save chbatey/8853910 to your computer and use it in GitHub Desktop.
Scala: Not a good way to test asynchronous code
test("Test a asynchronous method synchronously") {
val underTest = new ClassThatReturnsFutures()
val futureResult = underTest.goDoSomething()
futureResult onComplete {
case Success(value) => value should equal("Something")
case Failure(exp) => fail(exp)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment