make failing test deterministic for RemoteDeathWatchSpec

This commit is contained in:
Roland 2012-01-11 14:12:10 +01:00
parent 255a8c74e9
commit 358da77ae3

View file

@ -34,16 +34,23 @@ trait DeathWatchSpec { this: AkkaSpec with ImplicitSender with DefaultTimeout
"notify with one Terminated message when an Actor is stopped" in {
val terminal = system.actorOf(Props(context { case _ }))
startWatching(terminal)
testActor ! "ping"
expectMsg("ping")
startWatching(terminal) ! "hallo"
expectMsg("hallo") // this ensures that the DaemonMsgWatch has been received before we send the PoisonPill
terminal ! PoisonPill
expectTerminationOf(terminal)
}
"notify with one Terminated message when an Actor is already dead" in {
val terminal = system.actorOf(Props(context { case _ }))
terminal ! PoisonPill
startWatching(terminal)
expectTerminationOf(terminal)
}
"notify with all monitors with one Terminated message when an Actor is stopped" in {
val terminal = system.actorOf(Props(context { case _ }))
val monitor1, monitor2, monitor3 = startWatching(terminal)