我如何测试Akka成为/成为不受欢迎的过渡? [英] How can I test Akka become/unbecome transitions?

查看:51
本文介绍了我如何测试Akka成为/成为不受欢迎的过渡?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在推荐的方法来测试演员已使用行为正确更改了其行为?我更喜欢使用FSM的原因之一是因为我可以轻松地验证Actor已更改其行为。我不知道在使用变得/变得不受欢迎时该怎么做。

Is there a recommended way of testing that an actor has properly changed its behavior using become? One of the reasons I prefer using FSM is because I can easily verify that an Actor has changed its behavior. I don't know how I am supposed to do this when using become/unbecome.

推荐答案

尽管我认为有可能推出一个自定义的pub / sub whaty,它将通知订户有关状态转换的信息,如果我是你,我不会打扰。您要测试的是新行为,而不是事实是过渡是由实现细节(例如变得/变得不受欢迎或FSM)引起的。尽管使用FSM做到这一点很容易,但我还是给您;)

Although I suppose it would be possible to roll out a custom pub/sub thingy, which would notify subscribers about state transitions, I wouldn't bother if I were you. What you want to test is the new behavior not the fact that the transition was caused by an implementation detail like become/unbecome or FSM for that matter. Although it is quite easy to do this with FSM, I give you that ;)

这篇关于我如何测试Akka成为/成为不受欢迎的过渡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆