diff options
author | Adam Warski <adam@warski.org> | 2018-05-18 15:52:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-18 15:52:12 +0200 |
commit | 588395d018c258eb74f60ad95bad706698bdf915 (patch) | |
tree | 2c4ee642d8efb9e6785da3fe8a7decba507329ab /tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala | |
parent | 96ff655f906f2e3f4e9ba906c42e96506f4668b9 (diff) | |
parent | 5980017ece9be1ebf30775e5babf81e0e2f1fcd9 (diff) | |
download | sttp-588395d018c258eb74f60ad95bad706698bdf915.tar.gz sttp-588395d018c258eb74f60ad95bad706698bdf915.tar.bz2 sttp-588395d018c258eb74f60ad95bad706698bdf915.zip |
Merge pull request #93 from guymers/scalajs-1
Extract MonadAsyncError implementations
Diffstat (limited to 'tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala')
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala index 392f6d8..55e21b8 100644 --- a/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala +++ b/tests/src/test/scala/com/softwaremill/sttp/BasicTests.scala @@ -19,8 +19,12 @@ import com.softwaremill.sttp.asynchttpclient.cats.AsyncHttpClientCatsBackend import com.softwaremill.sttp.asynchttpclient.future.AsyncHttpClientFutureBackend import com.softwaremill.sttp.asynchttpclient.monix.AsyncHttpClientMonixBackend import com.softwaremill.sttp.asynchttpclient.scalaz.AsyncHttpClientScalazBackend +import com.softwaremill.sttp.impl.cats.convertCatsIOToFuture +import com.softwaremill.sttp.impl.monix.convertMonixTaskToFuture +import com.softwaremill.sttp.impl.scalaz.convertScalazTaskToFuture import com.softwaremill.sttp.okhttp.monix.OkHttpMonixBackend import com.softwaremill.sttp.okhttp.{OkHttpFutureBackend, OkHttpSyncBackend} +import com.softwaremill.sttp.testing.streaming.ConvertToFuture import com.typesafe.scalalogging.StrictLogging import org.scalatest.concurrent.{IntegrationPatience, ScalaFutures} import org.scalatest.{path => _, _} @@ -180,19 +184,20 @@ class BasicTests var closeBackends: List[() => Unit] = Nil - runTests("HttpURLConnection")(HttpURLConnectionBackend(), ForceWrappedValue.id) - runTests("TryHttpURLConnection")(TryHttpURLConnectionBackend(), ForceWrappedValue.scalaTry) - runTests("Akka HTTP")(AkkaHttpBackend.usingActorSystem(actorSystem), ForceWrappedValue.future) - runTests("Async Http Client - Future")(AsyncHttpClientFutureBackend(), ForceWrappedValue.future) - runTests("Async Http Client - Scalaz")(AsyncHttpClientScalazBackend(), ForceWrappedValue.scalazTask) - runTests("Async Http Client - Monix")(AsyncHttpClientMonixBackend(), ForceWrappedValue.monixTask) - runTests("Async Http Client - Cats Effect")(AsyncHttpClientCatsBackend[cats.effect.IO](), ForceWrappedValue.catsIo) - runTests("OkHttpSyncClientHandler")(OkHttpSyncBackend(), ForceWrappedValue.id) - runTests("OkHttpAsyncClientHandler - Future")(OkHttpFutureBackend(), ForceWrappedValue.future) - runTests("OkHttpAsyncClientHandler - Monix")(OkHttpMonixBackend(), ForceWrappedValue.monixTask) - - def runTests[R[_]](name: String)(implicit backend: SttpBackend[R, Nothing], - forceResponse: ForceWrappedValue[R]): Unit = { + runTests("HttpURLConnection")(HttpURLConnectionBackend(), ConvertToFuture.id) + runTests("TryHttpURLConnection")(TryHttpURLConnectionBackend(), ConvertToFuture.scalaTry) + runTests("Akka HTTP")(AkkaHttpBackend.usingActorSystem(actorSystem), ConvertToFuture.future) + runTests("Async Http Client - Future")(AsyncHttpClientFutureBackend(), ConvertToFuture.future) + runTests("Async Http Client - Scalaz")(AsyncHttpClientScalazBackend(), convertScalazTaskToFuture) + runTests("Async Http Client - Monix")(AsyncHttpClientMonixBackend(), convertMonixTaskToFuture) + runTests("Async Http Client - Cats IO")(AsyncHttpClientCatsBackend[cats.effect.IO](), convertCatsIOToFuture) + runTests("OkHttpSyncClientHandler")(OkHttpSyncBackend(), ConvertToFuture.id) + runTests("OkHttpAsyncClientHandler - Future")(OkHttpFutureBackend(), ConvertToFuture.future) + runTests("OkHttpAsyncClientHandler - Monix")(OkHttpMonixBackend(), convertMonixTaskToFuture) + + def runTests[R[_]](name: String)(implicit + backend: SttpBackend[R, Nothing], + convertToFuture: ConvertToFuture[R]): Unit = { closeBackends = (() => backend.close()) :: closeBackends |