akka-testkit

Uncaught error from default dispatcher causes fatal error with JavaTestKit

[亡魂溺海] 提交于 2019-12-01 11:36:30
问题 I'm just getting my feet wet with Akka. I'm trying to write a JUNit test using the JavaTestKit from this Maven dependency: <dependency> <groupId>com.typesafe.akka</groupId> <artifactId>akka-actor_2.10</artifactId> <version>2.3.12</version> </dependency> <dependency> <groupId>com.typesafe.akka</groupId> <artifactId>akka-testkit_2.11</artifactId> <version>2.3.12</version> </dependency> Even a JavaTestKit instance that does nothing will throw a fatal exception, so I suspect there's a

How do I test an Akka actor that sends a message to another actor?

限于喜欢 提交于 2019-11-30 09:44:58
I'm using ScalaTest with the Akka TestKit to write unit and integration tests for an actor I've coded to simply send a message to another actor without mutating any internal state. Take this for example: class MyActor extends Actor { val anotherActor = context.actorOf(Props[AnotherActor]) def receive: Receive = { case MyMessage => anotherActor ! AnotherMessage } } I want to write a test that confirms that anotherActor processed AnotherMessage as a consequence of MyActor processing MyMessage . The classic example is to use TestActorRef to get at the underlying actor and check for some internal

How do I test an Akka actor that sends a message to another actor?

我的未来我决定 提交于 2019-11-29 14:42:06
问题 I'm using ScalaTest with the Akka TestKit to write unit and integration tests for an actor I've coded to simply send a message to another actor without mutating any internal state. Take this for example: class MyActor extends Actor { val anotherActor = context.actorOf(Props[AnotherActor]) def receive: Receive = { case MyMessage => anotherActor ! AnotherMessage } } I want to write a test that confirms that anotherActor processed AnotherMessage as a consequence of MyActor processing MyMessage .