diff --git a/src/test/scala/mockws/AuthenticationTest.scala b/src/test/scala/mockws/AuthenticationTest.scala index 60f4b7c..571ace1 100644 --- a/src/test/scala/mockws/AuthenticationTest.scala +++ b/src/test/scala/mockws/AuthenticationTest.scala @@ -26,10 +26,10 @@ class AuthenticationTest extends AnyFunSuite with Matchers with ScalaCheckProper } } - val wsResponseOk = await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.BASIC).get) + val wsResponseOk = await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.BASIC).get()) wsResponseOk.status shouldEqual OK - val wsResponseUnauthorized = await(ws.url("/").withAuth("user", "secret", WSAuthScheme.BASIC).get) + val wsResponseUnauthorized = await(ws.url("/").withAuth("user", "secret", WSAuthScheme.BASIC).get()) wsResponseUnauthorized.status shouldEqual UNAUTHORIZED ws.close() @@ -45,16 +45,16 @@ class AuthenticationTest extends AnyFunSuite with Matchers with ScalaCheckProper } a[UnsupportedOperationException] shouldBe thrownBy( - await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.NTLM).get) + await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.NTLM).get()) ) a[UnsupportedOperationException] shouldBe thrownBy( - await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.DIGEST).get) + await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.DIGEST).get()) ) a[UnsupportedOperationException] shouldBe thrownBy( - await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.KERBEROS).get) + await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.KERBEROS).get()) ) a[UnsupportedOperationException] shouldBe thrownBy( - await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.SPNEGO).get) + await(ws.url("/").withAuth("user", "s3cr3t", WSAuthScheme.SPNEGO).get()) ) } diff --git a/src/test/scala/mockws/Example.scala b/src/test/scala/mockws/Example.scala index 4f5480f..f68c508 100644 --- a/src/test/scala/mockws/Example.scala +++ b/src/test/scala/mockws/Example.scala @@ -11,6 +11,7 @@ import scala.concurrent.Future import scala.util.Try import org.scalatest.freespec.AnyFreeSpec import org.scalatest.matchers.should.Matchers +import play.api.libs.ws.readableAsString object ImplementationToTest { diff --git a/src/test/scala/mockws/MockWSTest.scala b/src/test/scala/mockws/MockWSTest.scala index 2f88491..8eae21d 100644 --- a/src/test/scala/mockws/MockWSTest.scala +++ b/src/test/scala/mockws/MockWSTest.scala @@ -20,6 +20,9 @@ import scala.concurrent.Future import scala.concurrent.duration._ import org.scalatest.funsuite.AnyFunSuite import org.scalatest.matchers.should.Matchers +import play.api.libs.ws.writeableOf_String +import play.api.libs.ws.readableAsString +import play.api.libs.ws.writeableOf_JsValue /** * Tests that [[MockWS]] simulates a WS client @@ -180,7 +183,7 @@ class MockWSTest extends AnyFunSuite with Matchers with ScalaCheckPropertyChecks } } - val wsResponse = await(ws.url("/").addHttpHeaders(CONTENT_TYPE -> "hello/world").get) + val wsResponse = await(ws.url("/").addHttpHeaders(CONTENT_TYPE -> "hello/world").get()) wsResponse.status shouldEqual OK wsResponse.body shouldEqual "hello/world" ws.close() @@ -198,7 +201,7 @@ class MockWSTest extends AnyFunSuite with Matchers with ScalaCheckPropertyChecks } } - val wsResponse = await(ws.url("/uri").addQueryStringParameters(q -> v).get) + val wsResponse = await(ws.url("/uri").addQueryStringParameters(q -> v).get()) wsResponse.status shouldEqual OK wsResponse.body shouldEqual v ws.close() @@ -218,8 +221,8 @@ class MockWSTest extends AnyFunSuite with Matchers with ScalaCheckPropertyChecks } } - await(ws.url("/uri").addHttpHeaders(Seq(q -> v): _*).get) - await(ws.url("/uri").addQueryStringParameters(Seq(q -> v): _*).get) + await(ws.url("/uri").addHttpHeaders(Seq(q -> v): _*).get()) + await(ws.url("/uri").addQueryStringParameters(Seq(q -> v): _*).get()) ws.close() } } diff --git a/src/test/scala/mockws/StreamingTest.scala b/src/test/scala/mockws/StreamingTest.scala index e56cd6f..51c798b 100644 --- a/src/test/scala/mockws/StreamingTest.scala +++ b/src/test/scala/mockws/StreamingTest.scala @@ -11,10 +11,13 @@ import play.api.mvc.MultipartFormData.DataPart import play.api.mvc.MultipartFormData.FilePart import play.api.mvc.MultipartFormData.Part import play.api.mvc.Results._ +import play.api.mvc.AnyContent +import play.api.mvc.Request import play.api.mvc.ResponseHeader import play.api.mvc.Result import play.api.test.FakeRequest import play.api.test.Helpers._ +import play.api.libs.ws.readableAsString import scala.collection.immutable.Seq import scala.concurrent.ExecutionContext.Implicits._ @@ -122,7 +125,7 @@ class StreamingTest extends AnyFunSuite with Matchers with ScalaCheckPropertyChe ws.close() } - val streamBackAction = Action { req => + val streamBackAction = Action { (req: Request[AnyContent]) => val inputWords: Seq[String] = Seq() ++ req.body.asMultipartFormData.toSeq.flatMap(_.dataParts("k1")) val returnWords = Seq(req.method + ": ") ++ inputWords val outputStream: Source[ByteString, _] = Source(returnWords.map(v => ByteString(v)))