document deadlock risk of TestProbe.watch(TestActorRef), see #2916
This commit is contained in:
parent
40a67a4097
commit
bb7a4b7d40
4 changed files with 58 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue