akka.testkit

TestFSMRef

class TestFSMRef[S, D, T <: Actor] extends TestActorRef[Nothing]

This is a specialised form of the TestActorRef with support for querying and setting the state of a FSM. Use a LoggingFSM with this class if you also need to inspect event traces.


val fsm = TestFSMRef(new Actor with LoggingFSM[Int, Null] {
    override def logDepth = 12
    startWith(1, null)
    when(1) {
      case Ev("hello") => goto(2)
    }
    when(2) {
      case Ev("world") => goto(1)
    }
  }
assert (fsm.stateName == 1)
fsm ! "hallo"
assert (fsm.stateName == 2)
assert (fsm.underlyingActor.getLog == IndexedSeq(FSMLogEntry(1, null, "hallo")))

Since

1.2

Linear Supertypes
TestActorRef[Nothing], LocalActorRef, LocalRef, ActorRefScope, ActorRefWithCell, InternalActorRef, ScalaActorRef, ActorRef, Serializable, Serializable, Comparable[ActorRef], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. TestFSMRef
  2. TestActorRef
  3. LocalActorRef
  4. LocalRef
  5. ActorRefScope
  6. ActorRefWithCell
  7. InternalActorRef
  8. ScalaActorRef
  9. ActorRef
  10. Serializable
  11. Serializable
  12. Comparable
  13. AnyRef
  14. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new TestFSMRef(system: ActorSystemImpl, _prerequisites: DispatcherPrerequisites, props: Props, supervisor: InternalActorRef, name: String)(implicit ev: <:<[T, FSM[S, D]])

Value Members

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

    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 cancelTimer(name: String): Unit

    Proxy for FSM.

    Proxy for FSM.cancelTimer.

  10. def clone(): AnyRef

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

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

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

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

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

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

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

    Definition Classes
    AnyRef → Any
  18. def getParent: InternalActorRef

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

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

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

    Definition Classes
    Any
  22. final def isLocal: Boolean

    Definition Classes
    LocalRef → ActorRefScope
  23. def isTerminated: Boolean

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

    Definition Classes
    AnyRef
  25. def newActorCell(system: ActorSystemImpl, ref: InternalActorRef, props: Props, supervisor: InternalActorRef): ActorCell

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

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

    Definition Classes
    AnyRef
  28. val path: ActorPath

    Definition Classes
    LocalActorRef → ActorRef
  29. def provider: ActorRefProvider

    Definition Classes
    LocalActorRef → InternalActorRef
  30. def receive(o: Any, sender: ActorRef): 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.

    Definition Classes
    TestActorRef
  31. 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.

    Definition Classes
    TestActorRef
  32. def restart(cause: Throwable): Unit

    Definition Classes
    LocalActorRef → InternalActorRef
  33. def resume(causedByFailure: Throwable): Unit

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

    Definition Classes
    LocalActorRef → InternalActorRef
  35. def setState(stateName: S = fsm.stateName, stateData: D = fsm.stateData, timeout: FiniteDuration = null, stopReason: Option[Reason] = None): Unit

    Change FSM state; any value left out defaults to the current FSM state (timeout defaults to None).

    Change FSM state; any value left out defaults to the current FSM state (timeout defaults to None). This method is directly equivalent to a corresponding transition initiated from within the FSM, including timeout and stop handling.

  36. def setTimer(name: String, msg: Any, timeout: FiniteDuration, repeat: Boolean): Unit

    Proxy for FSM.

    Proxy for FSM.setTimer.

  37. def start(): Unit

    Definition Classes
    LocalActorRef → InternalActorRef
  38. def stateData: D

    Get current state data of this FSM.

  39. def stateName: S

    Get current state name of this FSM.

  40. def stop(): Unit

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

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

    Definition Classes
    AnyRef
  43. final def tell(msg: Any, sender: ActorRef): Unit

    Definition Classes
    ActorRef
  44. def timerActive_?(name: String): Boolean

    Proxy for FSM.

    Proxy for FSM.timerActive_?.

  45. def toString(): String

    Definition Classes
    TestActorRef → ActorRef → AnyRef → Any
  46. def underlying: ActorCell

    Definition Classes
    LocalActorRef → ActorRefWithCell
  47. def underlyingActor: Nothing

    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.

    Definition Classes
    TestActorRef
  48. 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

    Definition Classes
    TestActorRef
  49. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()
  52. 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

    Definition Classes
    TestActorRef
  53. def writeReplace(): AnyRef

    Attributes
    protected
    Definition Classes
    LocalActorRef
    Annotations
    @throws()

Deprecated Value Members

  1. final def tell(msg: Any): Unit

    Definition Classes
    ActorRef
    Annotations
    @deprecated
    Deprecated

    (Since version 2.1) use the two-arg variant (typically getSelf() as second arg)

Inherited from TestActorRef[Nothing]

Inherited from LocalActorRef

Inherited from LocalRef

Inherited from ActorRefScope

Inherited from ActorRefWithCell

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

Ungrouped