How can I test expected message with akka testkit if I don't know all message details? Can I use somehow underscore "_"?
Example I can test:
echoActor ! "hello world"
expectMsg("hello world")
Example i want to test
case class EchoWithRandom(msg: String, random: Int)
echoWithRandomActor ! "hi again"
expectMsg(EchoWithRandom("hi again", _))
The way i don't want to use:
echoWithRandomActor ! "hi again"
val msg = receiveOne(1.second)
msg match {
case EchoWithRandom("hi again", _) => //ok
case _ => fail("something wrong")
}