I am trying to write my first Akka test and going through the documentation. I was running the very first example of it and getting following error:
[ERROR] [10/26/2017 14:08:55.371] [IngestionWorkerActorSpec-akka.actor.default-dispatcher-4] [akka://IngestionWorkerActorSpec/user/$b] Assertion failed: timeout (3 seconds) during expectMsg while waiting for Test message java.lang.AssertionError: assertion failed: timeout (3 seconds) during expectMsg while waiting for Test message
Below is the receive method of my test actor:
override def receive: Receive = {
case p: ProducerRecord[_,_] =>
sendChannel.send(p.value())
case _ => logger.error("Unknown type Producer Record Received.")
}
Testspec:
val uutActor =system.actorOf(IngestionWorkerActor.props(config, KafkaProducer))
"An actor must send " should {
"send back messages unchanged" in {
uutActor ! expected
Thread.sleep(50)
expectMsg(expected)
}
}
I wanted to test whether my actor is receiving the messages sent to it or not and later I wanted to modify it to see whether I am getting specific message or not. Any help is appreciated.