aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorPaweł Stawicki <pawelstawicki@gmail.com>2018-01-24 18:38:40 +0100
committerPaweł Stawicki <pawelstawicki@gmail.com>2018-01-24 18:38:40 +0100
commit9da3ff4fd8fc76772b365b1368d335d1722f007b (patch)
tree324cfea63e485080066c1d1f431ace2d1e68cd96 /core
parente60dab5c77bca2c3b7a76732e98b406a9d7a095e (diff)
downloadsttp-9da3ff4fd8fc76772b365b1368d335d1722f007b.tar.gz
sttp-9da3ff4fd8fc76772b365b1368d335d1722f007b.tar.bz2
sttp-9da3ff4fd8fc76772b365b1368d335d1722f007b.zip
Docs for thenResponseWithMonad, and a little code cleanup in test
Diffstat (limited to 'core')
-rw-r--r--core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala17
1 files changed, 7 insertions, 10 deletions
diff --git a/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala b/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala
index 22ceff3..fbf7a0b 100644
--- a/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala
+++ b/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala
@@ -159,18 +159,15 @@ class SttpBackendStubTests extends FlatSpec with Matchers with ScalaFutures {
it should "not hold the calling thread when passed a future monad" in {
val LongTimeMillis = 10000L
-
- val fm = new FutureMonad()
- val f = Future {
- Thread.sleep(LongTimeMillis)
- Response(Right("OK"), 200, "", Nil, Nil)
- }
-
val before = System.currentTimeMillis()
- implicit val s = SttpBackendStub(fm).whenAnyRequest
- .thenRespondWithMonad(f)
- val result = sttp
+ implicit val s = SttpBackendStub(new FutureMonad()).whenAnyRequest
+ .thenRespondWithMonad(Future {
+ Thread.sleep(LongTimeMillis)
+ Response(Right("OK"), 200, "", Nil, Nil)
+ })
+
+ sttp
.get(uri"http://example.org")
.send()