Skip to content

Instantly share code, notes, and snippets.

@rkuhn
Created November 7, 2012 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkuhn/4030167 to your computer and use it in GitHub Desktop.
Save rkuhn/4030167 to your computer and use it in GitHub Desktop.
JavaTestKit spotlight
new JavaTestKit(system) {{
final Props props = new Props(SomeActor.class);
final ActorRef subject = system.actorOf(props);
subject.tell("request", getRef());
expectMsgEquals(duration("1 second"), "response");
new Within(duration("3 seconds")) {
protected void run() {
subject.tell("hello", getRef());
final String reply = expectMsgClass(String.class);
// analyze reply ...
expectNoMsg();
}
};
}};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment