proxy isDefinedAt/apply through TestActorRef

This commit is contained in:
Roland 2011-04-21 21:31:24 +02:00
parent 4868f726c5
commit b6446f50dd
2 changed files with 26 additions and 2 deletions

View file

@ -18,6 +18,18 @@ class TestActorRef[T <: Actor](factory: () => T) extends LocalActorRef(factory,
dispatcher = CallingThreadDispatcher.global
receiveTimeout = None
/**
* Query actor's current receive behavior.
*/
override def isDefinedAt(o : Any) = actor.isDefinedAt(o)
/**
* Directly inject messages into actor receive behavior. Any exceptions
* thrown will be available to you, while still being able to use
* become/unbecome and their message counterparts.
*/
def apply(o : Any) { actor(o) }
/**
* Retrieve reference to the underlying actor, where the static type matches the factory used inside the
* constructor. Beware that this reference is discarded by the ActorRef upon restarting the actor (should this
@ -68,4 +80,4 @@ object TestActorRef {
"\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'."))
})
}
}