Skip to content

Instantly share code, notes, and snippets.

@vichu
Created November 22, 2018 23:26
Show Gist options
  • Save vichu/6dafcbefdc3499e30b7f89d0227a490e to your computer and use it in GitHub Desktop.
Save vichu/6dafcbefdc3499e30b7f89d0227a490e to your computer and use it in GitHub Desktop.
First example
import org.scalatest.FlatSpec
import org.scalatest.concurrent.ScalaFutures
class NetworkCallExampleTest extends FlatSpec with ScalaFutures {
it should "verify the future returns when complete" in {
val networkCallExample = new NetworkCallExample
//This will fail with a time out error
whenReady(networkCallExample.lengthOfTheResponse("testurl")) { res =>
assert(res == 10)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment