Package akka.testkit
Class TestActorRef<T extends Actor>
- java.lang.Object
- 
- akka.actor.LocalActorRef
- 
- akka.testkit.TestActorRef<T>
 
 
- 
- Direct Known Subclasses:
- TestFSMRef
 
 public class TestActorRef<T extends Actor> extends akka.actor.LocalActorRefThis special ActorRef is exclusively for use during unit testing in a single-threaded environment. Therefore, it overrides the dispatcher to CallingThreadDispatcher and sets the receiveTimeout to None. Otherwise, it acts just like a normal ActorRef. You may retrieve a reference to the underlying actor to test internal logic.- Since:
- 1.1
 
- 
- 
Constructor SummaryConstructors Constructor Description TestActorRef(ActorSystem _system, Props _props, ActorRef _supervisor, java.lang.String name)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T extends Actor>
 TestActorRef<T>apply(ActorRef supervisor, java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(ActorRef supervisor, scala.reflect.ClassTag<T> t, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(Props props, ActorRef supervisor, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(Props props, ActorRef supervisor, java.lang.String name, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(Props props, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(Props props, java.lang.String name, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(scala.Function0<T> factory, java.lang.String name, scala.reflect.ClassTag<T> evidence$2, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(scala.Function0<T> factory, scala.reflect.ClassTag<T> evidence$1, ActorSystem system)static <T extends Actor>
 TestActorRef<T>apply(scala.reflect.ClassTag<T> t, ActorSystem system)static <T extends Actor>
 TestActorRef<T>create(ActorSystem system, Props props)Java API: create a TestActorRef in the given system for the given props, with a random name.static <T extends Actor>
 TestActorRef<T>create(ActorSystem system, Props props, ActorRef supervisor)Java API: create a TestActorRef in the given system for the given props, with the given supervisor and a random name.static <T extends Actor>
 TestActorRef<T>create(ActorSystem system, Props props, ActorRef supervisor, java.lang.String name)Java API: create a TestActorRef in the given system for the given props, with the given supervisor and name.static <T extends Actor>
 TestActorRef<T>create(ActorSystem system, Props props, java.lang.String name)Java API: create a TestActorRef in the given system for the given props, with the given name.MessageDispatcherdispatcher()protected akka.actor.ActorCellnewActorCell(akka.actor.ActorSystemImpl system, akka.actor.InternalActorRef ref, Props props, MessageDispatcher dispatcher, akka.actor.InternalActorRef supervisor)Propsprops()voidreceive(java.lang.Object o)Directly inject messages into actor receive behavior.voidreceive(java.lang.Object o, ActorRef sender)Directly inject messages into actor receive behavior.java.lang.StringtoString()TunderlyingActor()Retrieve reference to the underlying actor, where the static type matches the factory used inside the constructor.ActorRefunwatch(ActorRef subject)Unregisters this actor from being a death monitor of the provided ActorRef This means that this actor will not get a Terminated()-message when the provided actor is permanently terminated.ActorRefwatch(ActorRef subject)Registers this actor to be a death monitor of the provided ActorRef This means that this actor will get a Terminated()-message when the provided actor is permanently terminated.
 
- 
- 
- 
Constructor Detail- 
TestActorRefpublic TestActorRef(ActorSystem _system, Props _props, ActorRef _supervisor, java.lang.String name) 
 
- 
 - 
Method Detail- 
applypublic static <T extends Actor> TestActorRef<T> apply(scala.Function0<T> factory, scala.reflect.ClassTag<T> evidence$1, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(scala.Function0<T> factory, java.lang.String name, scala.reflect.ClassTag<T> evidence$2, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(Props props, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(Props props, java.lang.String name, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(Props props, ActorRef supervisor, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(Props props, ActorRef supervisor, java.lang.String name, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(scala.reflect.ClassTag<T> t, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(ActorRef supervisor, scala.reflect.ClassTag<T> t, ActorSystem system) 
 - 
applypublic static <T extends Actor> TestActorRef<T> apply(ActorRef supervisor, java.lang.String name, scala.reflect.ClassTag<T> t, ActorSystem system) 
 - 
createpublic static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props, ActorRef supervisor, java.lang.String name) Java API: create a TestActorRef in the given system for the given props, with the given supervisor and name.
 - 
createpublic static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props, ActorRef supervisor) Java API: create a TestActorRef in the given system for the given props, with the given supervisor and a random name.
 - 
createpublic static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props, java.lang.String name) Java API: create a TestActorRef in the given system for the given props, with the given name.
 - 
createpublic static <T extends Actor> TestActorRef<T> create(ActorSystem system, Props props) Java API: create a TestActorRef in the given system for the given props, with a random name.
 - 
propspublic Props props() 
 - 
dispatcherpublic MessageDispatcher dispatcher() 
 - 
newActorCellprotected akka.actor.ActorCell newActorCell(akka.actor.ActorSystemImpl system, akka.actor.InternalActorRef ref, Props props, MessageDispatcher dispatcher, akka.actor.InternalActorRef supervisor)
 - 
receivepublic void receive(java.lang.Object o) Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome.
 - 
receivepublic void receive(java.lang.Object o, ActorRef sender)Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome.
 - 
underlyingActorpublic T underlyingActor() 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 reference be linked to a supervisor). The old Actor may of course still be used in post-mortem assertions.
 - 
watchpublic ActorRef watch(ActorRef subject) Registers this actor to be a death monitor of the provided ActorRef This means that this actor will get a Terminated()-message when the provided actor is permanently terminated.- Returns:
- the same ActorRef that is provided to it, to allow for cleaner invocations
 
 - 
unwatchpublic ActorRef unwatch(ActorRef subject) Unregisters this actor from being a death monitor of the provided ActorRef This means that this actor will not get a Terminated()-message when the provided actor is permanently terminated.- Returns:
- the same ActorRef that is provided to it, to allow for cleaner invocations
 
 - 
toStringpublic java.lang.String toString() 
 
- 
 
-