diff options
author | Adam Warski <adam@warski.org> | 2018-05-21 14:28:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 14:28:29 +0200 |
commit | b7de29680d64c8465ba9b612cb9d903cbbc12291 (patch) | |
tree | 0d7a6b1c653393de8422e9704b9e68bb5cf7ed91 /core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala | |
parent | 588395d018c258eb74f60ad95bad706698bdf915 (diff) | |
parent | ccb1afe90e938fc2b8619dd960a1df1937f212be (diff) | |
download | sttp-b7de29680d64c8465ba9b612cb9d903cbbc12291.tar.gz sttp-b7de29680d64c8465ba9b612cb9d903cbbc12291.tar.bz2 sttp-b7de29680d64c8465ba9b612cb9d903cbbc12291.zip |
Move backend tests into their projects
Diffstat (limited to 'core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala')
-rw-r--r-- | core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala b/core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala new file mode 100644 index 0000000..4336a0c --- /dev/null +++ b/core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala @@ -0,0 +1,37 @@ +package com.softwaremill.sttp + +import com.softwaremill.sttp.testing.EvalScala +import org.scalatest.{FlatSpec, Matchers} + +import scala.tools.reflect.ToolBoxError + +class IllTypedTests extends FlatSpec with Matchers { + "compilation" should "fail when trying to stream using the default backend" in { + val thrown = intercept[ToolBoxError] { + EvalScala(""" + import com.softwaremill.sttp._ + + class MyStream[T]() + + implicit val sttpBackend = HttpURLConnectionBackend() + sttp.get(uri"http://example.com").response(asStream[MyStream[Byte]]).send() + """) + } + + thrown.getMessage should include( + "could not find implicit value for parameter backend: com.softwaremill.sttp.SttpBackend[R,MyStream[Byte]]" + ) + } + + "compilation" should "fail when trying to send a request without giving an URL" in { + val thrown = intercept[ToolBoxError] { + EvalScala(""" + import com.softwaremill.sttp._ + implicit val sttpBackend = HttpURLConnectionBackend() + sttp.send() + """) + } + + thrown.getMessage should include("This is a partial request, the method & url are not specified") + } +} |