aboutsummaryrefslogtreecommitdiff
path: root/tests/src/test/scala/com
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-07-21 16:40:07 +0200
committeradamw <adam@warski.org>2017-07-21 16:40:07 +0200
commite5ebd242a4cb982af6b01ec1976ecfc91398189f (patch)
tree3ca28ad0c4409d05bf50c3059e783a08d0947153 /tests/src/test/scala/com
parent1e8b6064c3855a85c340165fad7feefaf656e074 (diff)
downloadsttp-e5ebd242a4cb982af6b01ec1976ecfc91398189f.tar.gz
sttp-e5ebd242a4cb982af6b01ec1976ecfc91398189f.tar.bz2
sttp-e5ebd242a4cb982af6b01ec1976ecfc91398189f.zip
Scalaz version of the async http client handler, wrapping responses in a Task
Diffstat (limited to 'tests/src/test/scala/com')
-rw-r--r--tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala9
-rw-r--r--tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala5
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala
index 96fbbae..f456fb1 100644
--- a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala
+++ b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala
@@ -16,7 +16,8 @@ import com.typesafe.scalalogging.StrictLogging
import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures}
import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers}
import better.files._
-import com.softwaremill.sttp.asynchttpclient.AsyncHttpClientHandler
+import com.softwaremill.sttp.asynchttpclient.future.FutureAsyncHttpClientHandler
+import com.softwaremill.sttp.asynchttpclient.scalaz.ScalazAsyncHttpClientHandler
import scala.language.higherKinds
@@ -117,8 +118,10 @@ class BasicTests
ForceWrappedValue.id)
runTests("Akka HTTP")(new AkkaHttpSttpHandler(actorSystem),
ForceWrappedValue.future)
- runTests("Async Http Client")(new AsyncHttpClientHandler(),
- ForceWrappedValue.future)
+ runTests("Async Http Client - Future")(new FutureAsyncHttpClientHandler(),
+ ForceWrappedValue.future)
+ runTests("Async Http Client - Scalaz")(new ScalazAsyncHttpClientHandler(),
+ ForceWrappedValue.scalazTask)
def runTests[R[_]](name: String)(
implicit handler: SttpHandler[R, Nothing],
diff --git a/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala b/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala
index 6d83848..9114d8b 100644
--- a/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala
+++ b/tests/src/test/scala/com/softwaremill/sttp/testHelpers.scala
@@ -9,6 +9,7 @@ import org.scalatest.concurrent.ScalaFutures
import scala.concurrent.Future
import scala.language.higherKinds
+import scalaz.concurrent.Task
trait TestHttpServer extends BeforeAndAfterAll with ScalaFutures {
this: Suite =>
@@ -43,6 +44,10 @@ trait ForceWrapped extends ScalaFutures { this: Suite =>
override def force[T](wrapped: Future[T]): T =
wrapped.futureValue
}
+ val scalazTask = new ForceWrappedValue[Task] {
+ override def force[T](wrapped: Task[T]): T =
+ wrapped.unsafePerformSync
+ }
}
implicit class ForceDecorator[R[_], T](wrapped: R[T]) {
def force()(implicit fwv: ForceWrappedValue[R]): T = fwv.force(wrapped)