final class ActorTestKit extends AnyRef
Testkit for asynchronous testing of typed actors, meant for mixing into the test class.
Provides a typed actor system started on creation, used for all test cases and 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 shutdown after all tests has run needs to be provided by the user.
For synchronous testing of a Behavior
see BehaviorTestKit
- Source
- ActorTestKit.scala
- Alphabetic
- By Inheritance
- ActorTestKit
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- 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
- 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()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- val config: Config
- 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.
- 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.
- 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
- 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
- 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.
- 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
- 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
- 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
- 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
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- val internalSystem: typed.ActorSystem[_]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- val name: String
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def scheduler: typed.Scheduler
- val serializationTestKit: SerializationTestKit
Additional testing utilities for serialization.
- def shutdownTestKit(): Unit
- def spawn[T](behavior: Behavior[T], name: String, props: typed.Props): typed.ActorRef[T]
Spawn the given behavior.
Spawn the given behavior. This is created as a child of the test kit guardian
- def spawn[T](behavior: Behavior[T], name: String): typed.ActorRef[T]
Spawn the given behavior.
Spawn the given behavior. This is created as a child of the test kit guardian
- def spawn[T](behavior: Behavior[T], props: typed.Props): typed.ActorRef[T]
Spawn the given behavior.
Spawn the given behavior. This is created as a child of the test kit guardian
- def spawn[T](behavior: Behavior[T]): typed.ActorRef[T]
Spawn the given behavior.
Spawn the given behavior. This is created as a child of the test kit guardian
- def stop[T](ref: typed.ActorRef[T], max: FiniteDuration = timeout.duration): 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. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- implicit def system: typed.ActorSystem[Nothing]
INTERNAL API
- implicit def testKitSettings: TestKitSettings
- implicit val timeout: Timeout
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- 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
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- 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.