Let's take this code..
public void testIt() throws IOException {
new JavaTestKit(system) {{
final Props props = Props.create(MyActor.class);
final ActorRef subject = system.actorOf(props);
ByteString someBytes =
ByteString.fromArray("abcd".getBytes())
subject.tell(someBytes, getSelf());
//await response
Actor1 actor1 = expectMsgClass(Actor1.class);
Actor2 actor2 = expectMsgClass(Actor2.class);
}};
}
in myActor.java
actor1Ref and actor2Ref are ActorRef of Actor1 and Actor2 actors.
....
@Override
public void onReceive(Object message) {
if(message instanceof ByteString) {
// do something
getSender().tell(actor1Ref, getSelf());
// some more things
getSender().tell(actor2Ref, getSelf());
}
...
}
The order
Actor1 actor1 = expectMsgClass(Actor1.class);
Actor2 actor2 = expectMsgClass(Actor2.class);
seems to work and test passes. if actor1 message arrives late, the test
would fail I think.
Is there a way to say expectMsgClassesInNoParticularOrder(Actor1.class,
Actor2.class) ?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> 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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.