don’t use the testActor.queue for probe.watch(), see #2915
This commit is contained in:
parent
40a67a4097
commit
405174d4c3
3 changed files with 21 additions and 13 deletions
|
|
@ -62,8 +62,8 @@ class TestActor(queue: BlockingDeque[TestActor.Message]) extends Actor {
|
|||
|
||||
def receive = {
|
||||
case SetIgnore(ign) ⇒ ignore = ign
|
||||
case x @ Watch(ref) ⇒ context.watch(ref); queue.offerLast(RealMessage(x, self))
|
||||
case x @ UnWatch(ref) ⇒ context.unwatch(ref); queue.offerLast(RealMessage(x, self))
|
||||
case Watch(ref) ⇒ context.watch(ref)
|
||||
case UnWatch(ref) ⇒ context.unwatch(ref)
|
||||
case SetAutoPilot(pilot) ⇒ autopilot = pilot
|
||||
case x: AnyRef ⇒
|
||||
autopilot = autopilot.run(sender, x) match {
|
||||
|
|
@ -146,23 +146,19 @@ trait TestKitBase {
|
|||
def ignoreNoMsg() { testActor ! TestActor.SetIgnore(None) }
|
||||
|
||||
/**
|
||||
* Have the testActor watch someone (i.e. `context.watch(...)`). Waits until
|
||||
* the Watch message is received back using expectMsg.
|
||||
* Have the testActor watch someone (i.e. `context.watch(...)`).
|
||||
*/
|
||||
def watch(ref: ActorRef): ActorRef = {
|
||||
val msg = TestActor.Watch(ref)
|
||||
testActor ! msg
|
||||
expectMsg(msg).ref
|
||||
testActor ! TestActor.Watch(ref)
|
||||
ref
|
||||
}
|
||||
|
||||
/**
|
||||
* Have the testActor stop watching someone (i.e. `context.unwatch(...)`). Waits until
|
||||
* the Watch message is received back using expectMsg.
|
||||
* Have the testActor stop watching someone (i.e. `context.unwatch(...)`).
|
||||
*/
|
||||
def unwatch(ref: ActorRef): ActorRef = {
|
||||
val msg = TestActor.UnWatch(ref)
|
||||
testActor ! msg
|
||||
expectMsg(msg).ref
|
||||
testActor ! TestActor.UnWatch(ref)
|
||||
ref
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue