document deadlock risk of TestProbe.watch(TestActorRef), see #2916

This commit is contained in:
Roland 2013-01-23 23:38:22 +01:00
parent 40a67a4097
commit bb7a4b7d40
4 changed files with 58 additions and 0 deletions

View file

@ -17,6 +17,7 @@ import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Kill;
import akka.actor.Props;
import akka.actor.Terminated;
import akka.actor.UntypedActor;
import akka.actor.UntypedActorFactory;
import scala.concurrent.Await;
@ -300,6 +301,19 @@ public class TestKitDocTest {
//#test-special-probe
}
@Test
public void demonstrateWatch() {
final ActorRef target = system.actorFor("/buh");
//#test-probe-watch
new JavaTestKit(system) {{
final JavaTestKit probe = new JavaTestKit(system);
probe.watch(target);
final Terminated msg = probe.expectMsgClass(Terminated.class);
assertEquals(msg.getActor(), target);
}};
//#test-probe-watch
}
@Test
public void demonstrateReply() {
//#test-probe-reply