我使用Guice在角色中注入组件,因为它在Play! Scala 2.5 documentation中有解释。
在我的申请,我注入unshortLinksFactory: UnshortLinks.Factory
在我的课,我创建这样一个新的演员:
val unshortLinksActor = actorSystem.actorOf(Props(unshortLinksFactory(ws)))
如何使用Guice在Play中注入的组件测试角色! scala 2.5
的问题是,我不能在我的测试类注射组件(可以吗?)否则测试不开始。 (请注意,我使用Scalatest。)
如何在我的测试中创建演员? (这很好,如果我能像喜欢val unshortLinksActor = system.actorOf(Props(unshortLinksFactory(ws)))
创建它,但最好将能够与TestActorRef
从Akka.testKit
为了有机会获得underlyingActor
创建
你有没有找到解决这个问题的方法?我一直在努力解决同样的问题? – user1308752