mardi 30 août 2016

Scala Play test can't find WSClient during dependency injection

I'm trying to DI a class into a Unit Test, using the following:

val injector = new GuiceInjectorBuilder().injector()
val secured = injector.instanceOf[Secured]

However when I try and run it, I get the following error:

[info] Exception encountered when attempting to run a suite with class name: org.scalatest.DeferredAbortedSuite *** ABORTED ***
[info]   com.google.inject.ConfigurationException: Guice configuration errors:
[info] 
[info] 1) No implementation for play.api.libs.ws.WSClient was bound.
[info]   while locating play.api.libs.ws.WSClient
[info]     for parameter 3 at com.fredley.Secured.<init>(Secured.scala:36)
[info]   while locating com.fredley.Secured

...

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire