1
votes

I need to unit-test my application, involving sending a message to actor. I would like to get the whole system up and then replace some of actors with my "mock" instances, keeping original actors wrapped. The purpose of this is to get rid of Thread.sleep(xxxx) and make unit test more robust and not depending on JVM timings. Mocked actors supposed to "intercept" calls to actor. call the original actor and send notifcations back to unit test, so it can verify post-conditions.

I don't want to update existing "worker" actors for sending back such kind of notifications. I could refactor the code in order to pass actors for being registered in ActorSystem, however it is not desired. So if there is a way to get actor and replace it with new one - it would be great.

1
no, looks interesting, thanks! Consider putting this as answer and I'll accept it.jdevelop

1 Answers

1
votes

The Akka TestKit is tailor made for your needs.