Dear all,Reading the documentation I was unable to find a way to test for messages that an actor send to itself.Using the (Java)TestKit is quite easy to expect for messages that an actor send to someone else, but how to check for a message that an actor can send to itself ?
Hi Roland,I gave a try to PeekMailbox, but this would require to rewrite all the logic to mimic the methods expectMsgXxx which are pretty useful, too much work!.I solved overriding dynamically the actor getSelf() method retuning a new JavaTestKit.getRef() instance. This does the trick.Anyway in my opinion it is really a pity that this condition is not managed by the TestActorRef by default. There are many use case in which it is useful to test for messages against the self actor.
Cheers,PaoloOn Wed, Jan 2, 2013 at 8:36 PM, Roland Kuhn <goo...@rkuhn.info> wrote:
Hi Paolo,Messages sent to `self` are unobservable to the outside—unless they have some verifiable effect without which they would be pointless. If verifying the effect is somehow impractical then the closest I can think of is to create a SnitchMailbox which secretly keeps copies of all enqueued messages for later inspection. While trivial to do yourself—see the PeekMailbox in 2.1.0’s contrib area—I’m not sure whether it would be a good idea to ship such a thing as part of the official package …2 jan 2013 kl. 16:06 skrev Paolo Di Tommaso:Dear all,Reading the documentation I was unable to find a way to test for messages that an actor send to itself.Using the (Java)TestKit is quite easy to expect for messages that an actor send to someone else, but how to check for a message that an actor can send to itself ?Regards,
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user?hl=en.
I think that Akka is really an excellent framework and I take your work really seriously. I'm new to Akka so I'm really interested to learn as much as possible about it, but in this case I think we have two different points of view.Let me explain better my test case. Generally you can see an actor as a black box, when it receives a message, it will change its state and eventually it will send some other message(s) as consequence of the input event.So, what a test does for a particular message is to check the actor state changed as expected, and that the messages to other actors have been sent. Right?