mockws.MockWS
See theMockWS companion object
class MockWS(routes: Routes, shutdownHook: () => Unit)(implicit val materializer: Materializer, notFoundBehaviour: RouteNotDefined) extends WSClient
Mock implementation for the play.api.libs.ws.WSClient. Usage:
val ws = MockWS {
case ("GET", "/") => Action { Ok("index") }
case ("GET", "/hi") => Action { Ok("world") }
}
MockWS.Routes is a partial function. It is also possible to combine routes together:
val index = MockWS.Routes {
case ("GET", "/") => Action { Ok("index") }
}
val hiWorld = MockWS.Routes {
case ("GET", "/hi") => Action { Ok("world") }
}
val ws = MockWS(index orElse hiWorld)
Value parameters
- routes
-
routes defining the mock calls
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait WSClienttrait Closeabletrait AutoCloseableclass Objecttrait Matchableclass Any
Members list
In this article