Package akka.testkit

Class TestFSMRef<S,​D,​T extends Actor>

  • All Implemented Interfaces:
    ActorRefScope, LocalRef, ScalaActorRef,, java.lang.Comparable<ActorRef>

    public class TestFSMRef<S,​D,​T extends Actor>
    extends TestActorRef<T>
    This is a specialized 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 Event("hello", _) =&gt; goto(2)
         when(2) {
           case Event("world", _) =&gt; goto(1)
     assert (fsm.stateName == 1)
     fsm ! "hallo"
     assert (fsm.stateName == 2)
     assert (fsm.underlyingActor.getLog == IndexedSeq(FSMLogEntry(1, null, "hallo")))

    See Also:
    Serialized Form
    • Constructor Detail

      • TestFSMRef

        public TestFSMRef​(ActorSystem system,
                          Props props,
                          ActorRef supervisor,
                          java.lang.String name,
                          <any> ev)