Packages

final class ActorTestKit extends AnyRef

Java API: Test kit for asynchronous testing of typed actors. Provides a typed actor system started on creation, that can be used for multiple test cases and is shut down when shutdown is called.

The actor system has a custom guardian that allows for spawning arbitrary actors using the spawn methods.

Designed to work with any test framework, but framework glue code that calls shutdownTestKit after all tests has run needs to be provided by the user or with TestKitJunitResource.

Use TestKit.create factories to construct manually or TestKitJunitResource to use together with JUnit tests

For synchronous testing of a Behavior see BehaviorTestKit

Source
ActorTestKit.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ActorTestKit
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ActorTestKit toany2stringadd[ActorTestKit] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ActorTestKit, B)
    Implicit
    This member is added by an implicit conversion from ActorTestKit toArrowAssoc[ActorTestKit] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. def createDeadLetterProbe(): TestProbe[DeadLetter]

    returns

    A test probe that is subscribed to dead letters from the system event bus. Subscription will be completed and verified so any dead letter after it will be caught by the probe.

  9. def createDroppedMessageProbe(): TestProbe[Dropped]

    returns

    A test probe that is subscribed to dropped letters from the system event bus. Subscription will be completed and verified so any dropped letter after it will be caught by the probe.

  10. def createTestProbe[M](name: String, clazz: Class[M]): TestProbe[M]

    Shortcut for creating a new named test probe for the testkit actor system

    Shortcut for creating a new named test probe for the testkit actor system

    M

    the type of messages the probe should accept

  11. def createTestProbe[M](name: String): TestProbe[M]

    Shortcut for creating a new named test probe for the testkit actor system

    Shortcut for creating a new named test probe for the testkit actor system

    M

    the type of messages the probe should accept

  12. def createTestProbe[M](clazz: Class[M]): TestProbe[M]

    Shortcut for creating a new test probe for the testkit actor system

    Shortcut for creating a new test probe for the testkit actor system

    M

    the type of messages the probe should accept

  13. def createTestProbe[M](): TestProbe[M]

    Shortcut for creating a new test probe for the testkit actor system

    Shortcut for creating a new test probe for the testkit actor system

    M

    the type of messages the probe should accept

  14. def createUnhandledMessageProbe(): TestProbe[UnhandledMessage]

    returns

    A test probe that is subscribed to unhandled messages from the system event bus. Subscription will be completed and verified so any unhandled message after it will be caught by the probe.

  15. def ensuring(cond: (ActorTestKit) => Boolean, msg: => Any): ActorTestKit
    Implicit
    This member is added by an implicit conversion from ActorTestKit toEnsuring[ActorTestKit] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: (ActorTestKit) => Boolean): ActorTestKit
    Implicit
    This member is added by an implicit conversion from ActorTestKit toEnsuring[ActorTestKit] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. def ensuring(cond: Boolean, msg: => Any): ActorTestKit
    Implicit
    This member is added by an implicit conversion from ActorTestKit toEnsuring[ActorTestKit] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean): ActorTestKit
    Implicit
    This member is added by an implicit conversion from ActorTestKit toEnsuring[ActorTestKit] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  21. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ActorTestKit toStringFormat[ActorTestKit] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  22. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  28. def scheduler: typed.Scheduler

    The scheduler of the testkit actor system

  29. val serializationTestKit: SerializationTestKit

    Additional testing utilities for serialization.

  30. def shutdownTestKit(): Unit

    Terminate the actor system and the testkit

  31. def spawn[T](behavior: Behavior[T], name: String, props: typed.Props): typed.ActorRef[T]

    Spawn a new named actor under the testkit user guardian with the given props and return the ActorRef for the spawned actor, note that spawning actors with the same name in multiple test cases will cause failures.

  32. def spawn[T](behavior: Behavior[T], props: typed.Props): typed.ActorRef[T]

    Spawn a new auto-named actor under the testkit user guardian with the given props and return the ActorRef for the spawned actor

  33. def spawn[T](behavior: Behavior[T], name: String): typed.ActorRef[T]

    Spawn a new named actor under the testkit user guardian and return the ActorRef for the spawned actor, note that spawning actors with the same name in multiple test cases will cause failures.

  34. def spawn[T](behavior: Behavior[T]): typed.ActorRef[T]

    Spawn a new auto-named actor under the testkit user guardian and return the ActorRef for the spawned actor

  35. def stop[T](ref: typed.ActorRef[T], max: Duration): Unit

    Stop the actor under test and wait max until it terminates.

    Stop the actor under test and wait max until it terminates. It can only be used for actors that were spawned by this ActorTestKit. Other actors will not be stopped by this method.

  36. def stop[T](ref: typed.ActorRef[T]): Unit

    Stop the actor under test and wait until it terminates.

    Stop the actor under test and wait until it terminates. It can only be used for actors that were spawned by this ActorTestKit. Other actors will not be stopped by this method.

  37. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  38. def system: typed.ActorSystem[Void]

    The actor system running for this testkit.

    The actor system running for this testkit. Interaction with the user guardian is done through methods on the testkit which is why it is typed to Void.

  39. def testKitSettings: TestKitSettings
  40. def timeout: Timeout

    The default timeout as specified with the config/akka.actor.testkit.typed.TestKitSettings

  41. def toString(): String
    Definition Classes
    AnyRef → Any
  42. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  43. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  44. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

  2. def [B](y: B): (ActorTestKit, B)
    Implicit
    This member is added by an implicit conversion from ActorTestKit toArrowAssoc[ActorTestKit] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromActorTestKit to any2stringadd[ActorTestKit]

Inherited by implicit conversion StringFormat fromActorTestKit to StringFormat[ActorTestKit]

Inherited by implicit conversion Ensuring fromActorTestKit to Ensuring[ActorTestKit]

Inherited by implicit conversion ArrowAssoc fromActorTestKit to ArrowAssoc[ActorTestKit]

Ungrouped