aboutsummaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authoradamw <adam@warski.org>2017-10-25 11:02:06 +0200
committeradamw <adam@warski.org>2017-10-25 11:02:06 +0200
commitd665c4c7fb1b4df027be674f07ae1e63019cbf9d (patch)
tree7a35b583b11e0531d456ddeabf4a5f13ae8cf34e /core/src
parentd060d9e9ba2dc4b67a7a28abdafd455d02b43f5e (diff)
downloadsttp-d665c4c7fb1b4df027be674f07ae1e63019cbf9d.tar.gz
sttp-d665c4c7fb1b4df027be674f07ae1e63019cbf9d.tar.bz2
sttp-d665c4c7fb1b4df027be674f07ae1e63019cbf9d.zip
Fix compiler warnings
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala6
-rw-r--r--core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala10
2 files changed, 12 insertions, 4 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala b/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala
index 72d3490..f62959f 100644
--- a/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala
+++ b/core/src/main/scala/com/softwaremill/sttp/testing/SttpBackendStub.scala
@@ -41,7 +41,8 @@ class SttpBackendStub[R[_], S] private (rm: MonadError[R],
override def send[T](request: Request[T, S]): R[Response[T]] = {
matchers
.collectFirst {
- case matcher: Matcher[T] if matcher(request) => matcher.response(request).get
+ case matcher: Matcher[T @unchecked] if matcher(request) =>
+ matcher.response(request).get
} match {
case Some(response) => wrapResponse(response)
case None =>
@@ -111,7 +112,8 @@ object SttpBackendStub {
private val DefaultResponse =
Response[Nothing](Left("Not Found"), 404, Nil, Nil)
- private case class Matcher[T](p: PartialFunction[Request[T, _], Response[_]]) {
+ private case class Matcher[T](
+ p: PartialFunction[Request[T, _], Response[_]]) {
def apply(request: Request[T, _]): Boolean =
p.isDefinedAt(request)
diff --git a/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala b/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala
index d10d1b6..9e10cd7 100644
--- a/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala
+++ b/core/src/test/scala/com/softwaremill/sttp/testing/SttpBackendStubTests.scala
@@ -13,8 +13,14 @@ class SttpBackendStubTests extends FlatSpec with Matchers with ScalaFutures {
.whenRequestMatches(_.method == Method.GET)
.thenRespondServerError()
.whenRequestMatchesPartial({
- case r if r.method == Method.POST && r.uri.path.endsWith(List("partial10")) => Response(Right(10), 200, Nil, Nil)
- case r if r.method == Method.POST && r.uri.path.endsWith(List("partialAda")) => Response(Right("Ada"), 200, Nil, Nil)
+ case r
+ if r.method == Method.POST && r.uri.path.endsWith(
+ List("partial10")) =>
+ Response(Right(10), 200, Nil, Nil)
+ case r
+ if r.method == Method.POST && r.uri.path.endsWith(
+ List("partialAda")) =>
+ Response(Right("Ada"), 200, Nil, Nil)
})
"backend stub" should "use the first rule if it matches" in {