aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala
diff options
context:
space:
mode:
authorSam Guymer <sam@guymer.me>2018-05-20 21:02:37 +1000
committerSam Guymer <sam@guymer.me>2018-05-20 21:02:37 +1000
commitbcb94e252a96c78b1db29aebe47b18bfd337e764 (patch)
tree7462765d4dfcb2eda9a21591aba1bcfc51352b9f /core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala
parent92e10991df0d168d1972d4618fcc7e02e2e0a0fa (diff)
downloadsttp-bcb94e252a96c78b1db29aebe47b18bfd337e764.tar.gz
sttp-bcb94e252a96c78b1db29aebe47b18bfd337e764.tar.bz2
sttp-bcb94e252a96c78b1db29aebe47b18bfd337e764.zip
Code review updates
Remove tests sub project, all tests are now in core. Remove TestStreamingBackend, StreamingTest now has the required abstract methods.
Diffstat (limited to 'core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala')
-rw-r--r--core/src/test/scala/com/softwaremill/sttp/IllTypedTests.scala37
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")
+ }
+}