2
나는 배우를위한 단위 테스트를 쓰려고하는데 기본적인 조롱에 집착하고있다. PriceAggregateActor는 akka 지속성을 사용하고 있으며 모든 conf를 전달하지 않으려 고 완전히 모의하고 싶습니다. 난 항상 받고 있어요아카의 조롱 배우
class CommandPriceActorTest extends TestKit(ActorSystem("test-benefits",
ConfigFactory.parseString("""akka.loggers = ["akka.testkit.TestEventListener"] """))) with FlatSpecLike with Matchers
with BeforeAndAfterAll with Eventually{
class MockedChild extends Actor {
def receive = {
case _ => lala
}
}
val probe = TestProbe()
val commandPriceActor = TestActorRef(new CommandPriceActor(Props[MockedChild]))
:
Caused by: java.lang.IllegalArgumentException: no matching constructor found on class CommandPriceActorTest$MockedChild for arguments []
이
내가 뭔가를 할 노력하고있어 내 테스트에서 그래서object CommandPriceActor {
def apply() = Props(classOf[CommandPriceActor], PriceAggregateActor())
}
class CommandPriceActor(priceAggregateActorProps: Props) extends Actor with ActorLogging {
val priceAggregateActor = context.actorOf(priceAggregateActorProps, "priceAggregateActor")
을 테스트 할 배우
왜 mockedChild에 대해 불평합니까? 생성자 인수를 가져서는 안됩니다.
난 당신이 무슨 말을하는지 얻을하지만 코드에서 것을 어떻게 작성합니까? :) – Reeebuuk
몇 가지 예를 추가했습니다. 원래 대답은 내 전화로 공항에서 이루어졌습니다. – iain
매력처럼 작동합니다! Thx Ian :) – Reeebuuk