4

I want to test my akka actor. Is it possible to test every case of receive function?

def receive = {

  case msg: String =>
    println("SUCCESS" + msg)

  case user: VerifyIfUserExistActor =>
    implicit val timeout = Timeout(30 seconds)
    val future = platActor ? user
    val result = Await.result(future, timeout.duration).asInstanceOf[Users]
    sender ! result

  case ottDetails: OttDetails =>
    println("SUCCESS" + ottDetails)

}
4

1 回答 1

0

是的,如果您想测试您是否发送了成功的消息并且只想查看您的参与者系统是否正常工作。您可以使用

case _ => println("sending message success")
于 2012-11-03T09:59:23.417 回答