How do I test an Akka actor that sends a message to another actor?
问题 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 .