blob: 6137ed21ddaff0ebe60ebbed34b7da5cb083f7da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package com.softwaremill.sttp
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 handler" in {
val thrown = intercept[ToolBoxError] {
EvalScala(
"""
import com.softwaremill.sttp._
import akka.stream.scaladsl.Source
import akka.util.ByteString
implicit val sttpHandler = HttpURLConnectionSttpHandler
sttp.get(uri"http://example.com").response(asStream[Source[ByteString, Any]]).send()
""")
}
thrown.getMessage should include(
"could not find implicit value for parameter handler: com.softwaremill.sttp.SttpHandler[R,akka.stream.scaladsl.Source[akka.util.ByteString,Any]]")
}
"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 sttpHandler = HttpURLConnectionSttpHandler
sttp.send()
""")
}
thrown.getMessage should include(
"This is a partial request, the method & url are not specified")
}
}
|