0
我目前正在测试akka应用程序。 我碰到过某种模式:我想测试一个TestProbe
已经收到了某个消息,以某些字段为模。akka:测试邮件模数
例如,如果消息是:
UserInfo(username: String, score: Int, timestamp: String)
然后,我可能要测试username
和score
如预期,但在收到什么时候该消息并不关心。
目前我想写点东西像这样:
testProbe.expectMsgPF() {
case UserInfo(`username`, `score`, _) =>
}
怎么能测试探针类进行扩展,使这样的事情可能不是写的?
testProbe.expectApproxMsg(UserInfo(`username`, `score`, _))
除了缩短我的代码,我希望这个问题的答案会进一步我对Scala编程语言的理解。