ここのPlay 2.4ドキュメントで説明されているように、偽のサーバーでWSクライアントをテストしたい: https://www.playframework.com/documentation/2.4.x/ScalaTestingWebServiceClients
しかし、私は Scaldi で DI を行っていますが、Scaldi を使用するように Play のドキュメント コードを適応させることができません。
誰かが私を助けることができますか?
適応するコードは主にこれです(Play docから来ます):
"GitHubClient" should {
"get all repositories" in {
Server.withRouter() {
case GET(p"/repositories") => Action {
Results.Ok(Json.arr(Json.obj("full_name" -> "octocat/Hello-World")))
}
} { implicit port =>
WsTestClient.withClient { client =>
val result = Await.result(
new GitHubClient(client, "").repositories(), 10.seconds)
result must_== Seq("octocat/Hello-World")
}
}
}
}