akka.testkit

TestActorRef

class TestActorRef[T <: Actor] extends LocalActorRef

This 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

Linear Supertypes
LocalActorRef, LocalRef, ActorRefScope, InternalActorRef, ScalaActorRef, ActorRef, Serializable, Serializable, Comparable[ActorRef], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. TestActorRef
  2. LocalActorRef
  3. LocalRef
  4. ActorRefScope
  5. InternalActorRef
  6. ScalaActorRef
  7. ActorRef
  8. Serializable
  9. Serializable
  10. Comparable
  11. AnyRef
  12. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TestActorRef(_system: ActorSystemImpl, _prerequisites: DispatcherPrerequisites, _props: Props, _supervisor: InternalActorRef, name: String)

Value Members

  1. def !(message: Any)(implicit sender: ActorRef = null): Unit

    Sends a one-way asynchronous message.

    Sends a one-way asynchronous message. E.g. fire-and-forget semantics.

    If invoked from within an actor then the actor reference is implicitly passed on as the implicit 'sender' argument.

    This actor 'sender' reference is then available in the receiving actor in the 'sender' member variable, if invoked from within an Actor. If not then no sender is available.

      actor ! message
    

    Definition Classes
    LocalActorRef → ScalaActorRef
  2. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  3. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  4. final def ##(): Int

    Definition Classes
    AnyRef → Any
  5. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  6. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  7. def actorContext: ActorContext

    Attributes
    protected
    Definition Classes
    LocalActorRef
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  10. final def compareTo(other: ActorRef): Int

    Comparison only takes address into account.

    Comparison only takes address into account.

    Definition Classes
    ActorRef → Comparable
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. final def equals(that: Any): Boolean

    Definition Classes
    ActorRef → AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. def forward(message: Any)(implicit context: ActorContext): Unit

    Forwards the message and passes the original sender actor as the sender.

    Forwards the message and passes the original sender actor as the sender.

    Works with '!' and '?'/'ask'.

    Definition Classes
    ActorRef
  15. def getChild(names: Iterator[String]): InternalActorRef

    Obtain ActorRef by possibly traversing the actor tree or looking it up at some provider-specific location.

    Obtain ActorRef by possibly traversing the actor tree or looking it up at some provider-specific location. This method shall return the end result, i.e. not only the next step in the look-up; this will typically involve recursive invocation. A path element of ".." signifies the parent, a trailing "" element must be disregarded. If the requested path does not exist, return Nobody.

    Definition Classes
    LocalActorRef → InternalActorRef
  16. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  17. def getParent: InternalActorRef

    Obtain parent of this ref; used by getChild for ".

    Obtain parent of this ref; used by getChild for ".." paths.

    Definition Classes
    LocalActorRef → InternalActorRef
  18. def getSingleChild(name: String): InternalActorRef

    Method for looking up a single child beneath this actor.

    Method for looking up a single child beneath this actor. Override in order to inject “synthetic” actor paths like “/temp”.

    Attributes
    protected
    Definition Classes
    LocalActorRef
  19. final def hashCode(): Int

    Definition Classes
    ActorRef → AnyRef → Any
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. final def isLocal: Boolean

    Definition Classes
    LocalRefActorRefScope
  22. def isTerminated: Boolean

    Is the actor terminated? If this method returns true, it will never return false again, but if it returns false, you cannot be sure if it's alive still (race condition)

    Is the actor terminated? If this method returns true, it will never return false again, but if it returns false, you cannot be sure if it's alive still (race condition)

    Definition Classes
    LocalActorRef → ActorRef
  23. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  24. def newActorCell(system: ActorSystemImpl, ref: InternalActorRef, props: Props, supervisor: InternalActorRef, receiveTimeout: Option[Duration]): ActorCell

    Definition Classes
    TestActorRef → LocalActorRef
  25. final def notify(): Unit

    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  27. val path: ActorPath

    Returns the path for this actor (from this actor up to the root actor).

    Returns the path for this actor (from this actor up to the root actor).

    Definition Classes
    LocalActorRef → ActorRef
  28. def provider: ActorRefProvider

    Get a reference to the actor ref provider which created this ref.

    Get a reference to the actor ref provider which created this ref.

    Definition Classes
    LocalActorRef → InternalActorRef
  29. def receive(o: Any): Unit

    Directly inject messages into actor receive behavior.

    Directly inject messages into actor receive behavior. Any exceptions thrown will be available to you, while still being able to use become/unbecome.

  30. def restart(cause: Throwable): Unit

    Definition Classes
    LocalActorRef → InternalActorRef
  31. def resume(): Unit

    Resumes a suspended actor.

    Resumes a suspended actor.

    Definition Classes
    LocalActorRef → InternalActorRef
  32. def sendSystemMessage(message: SystemMessage): Unit

    Definition Classes
    LocalActorRef → InternalActorRef
  33. def stop(): Unit

    Shuts down the actor and its message queue

    Shuts down the actor and its message queue

    Definition Classes
    LocalActorRef → InternalActorRef
  34. def suspend(): Unit

    Suspends the actor so that it will not process messages until resumed.

    Suspends the actor so that it will not process messages until resumed. The suspend request is processed asynchronously to the caller of this method as well as to normal message sends: the only ordering guarantee is that message sends done from the same thread after calling this method will not be processed until resumed.

    Definition Classes
    LocalActorRef → InternalActorRef
  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  36. val systemService: Boolean

    Definition Classes
    LocalActorRef
  37. final def tell(msg: Any, sender: ActorRef): Unit

    Java API.

    Java API.

    Sends the specified message to the sender, i.e. fire-and-forget semantics, including the sender reference if possible (not supported on all senders).

    actor.tell(message, context);
    

    Definition Classes
    ActorRef
  38. final def tell(msg: Any): Unit

    Sends the specified message to the sender, i.

    Sends the specified message to the sender, i.e. fire-and-forget semantics.

    actor.tell(message);
    

    Definition Classes
    ActorRef
  39. def toString(): String

    Definition Classes
    TestActorRefActorRef → AnyRef → Any
  40. def underlying: ActorCell

    Attributes
    protected[akka]
    Definition Classes
    LocalActorRef
  41. def underlyingActor: T

    Retrieve reference to the underlying actor, where the static type matches the factory used inside the constructor.

    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.

  42. def unwatch(subject: ActorRef): ActorRef

    Deregisters 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.

    Deregisters 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

  43. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  44. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  45. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  46. def watch(subject: ActorRef): ActorRef

    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.

    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

  47. def writeReplace(): AnyRef

    Attributes
    protected
    Definition Classes
    LocalActorRef
    Annotations
    @throws( ... )

Inherited from LocalActorRef

Inherited from LocalRef

Inherited from ActorRefScope

Inherited from InternalActorRef

Inherited from ScalaActorRef

Inherited from ActorRef

Inherited from Serializable

Inherited from Serializable

Inherited from Comparable[ActorRef]

Inherited from AnyRef

Inherited from Any