Class ActorTestKitBase
- java.lang.Object
-
- akka.actor.testkit.typed.scaladsl.ActorTestKitBase
-
- Direct Known Subclasses:
ScalaTestWithActorTestKit
public abstract class ActorTestKitBase extends java.lang.Object
A base class for theActorTestKit
, making it possible to have testing framework (e.g. ScalaTest) manage the lifecycle of the testkit.An implementation for ScalaTest is
ScalaTestWithActorTestKit
.Another abstract class that is testing framework specific should extend this class and automatically shut down the
testKit
when the test completes or fails by implementingafterAll()
.
-
-
Constructor Summary
Constructors Constructor Description ActorTestKitBase()
ActorTestKitBase(ActorTestKit testKit)
ActorTestKitBase(com.typesafe.config.Config config)
Use a custom config for the actor system.ActorTestKitBase(com.typesafe.config.Config config, TestKitSettings settings)
Use a custom config for the actor system, and a customTestKitSettings
.ActorTestKitBase(java.lang.String config)
Use a custom config for the actor system.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
afterAll()
To be implemented by "more" concrete class that can mixinBeforeAndAfterAll
or similar, for exampleFlatSpecLike with BeforeAndAfterAll
.TestProbe<DeadLetter>
createDeadLetterProbe()
See corresponding method onActorTestKit
TestProbe<Dropped>
createDroppedMessageProbe()
See corresponding method onActorTestKit
<M> TestProbe<M>
createTestProbe()
See corresponding method onActorTestKit
<M> TestProbe<M>
createTestProbe(java.lang.String name)
See corresponding method onActorTestKit
TestProbe<UnhandledMessage>
createUnhandledMessageProbe()
See corresponding method onActorTestKit
SerializationTestKit
serializationTestKit()
Additional testing utilities for serialization.<T> ActorRef<T>
spawn(Behavior<T> behavior)
See corresponding method onActorTestKit
<T> ActorRef<T>
spawn(Behavior<T> behavior, Props props)
See corresponding method onActorTestKit
<T> ActorRef<T>
spawn(Behavior<T> behavior, java.lang.String name)
See corresponding method onActorTestKit
<T> ActorRef<T>
spawn(Behavior<T> behavior, java.lang.String name, Props props)
See corresponding method onActorTestKit
ActorSystem<scala.runtime.Nothing$>
system()
See corresponding method onActorTestKit
ActorTestKit
testKit()
TestKitSettings
testKitSettings()
See corresponding method onActorTestKit
static java.lang.String
testNameFromCallStack()
Timeout
timeout()
See corresponding method onActorTestKit
-
-
-
Constructor Detail
-
ActorTestKitBase
public ActorTestKitBase(ActorTestKit testKit)
-
ActorTestKitBase
public ActorTestKitBase()
-
ActorTestKitBase
public ActorTestKitBase(java.lang.String config)
Use a custom config for the actor system.
-
ActorTestKitBase
public ActorTestKitBase(com.typesafe.config.Config config)
Use a custom config for the actor system.
-
ActorTestKitBase
public ActorTestKitBase(com.typesafe.config.Config config, TestKitSettings settings)
Use a custom config for the actor system, and a customTestKitSettings
.
-
-
Method Detail
-
testNameFromCallStack
public static java.lang.String testNameFromCallStack()
-
testKit
public ActorTestKit testKit()
-
system
public ActorSystem<scala.runtime.Nothing$> system()
See corresponding method onActorTestKit
-
testKitSettings
public TestKitSettings testKitSettings()
See corresponding method onActorTestKit
-
timeout
public Timeout timeout()
See corresponding method onActorTestKit
-
spawn
public <T> ActorRef<T> spawn(Behavior<T> behavior)
See corresponding method onActorTestKit
-
spawn
public <T> ActorRef<T> spawn(Behavior<T> behavior, java.lang.String name)
See corresponding method onActorTestKit
-
spawn
public <T> ActorRef<T> spawn(Behavior<T> behavior, Props props)
See corresponding method onActorTestKit
-
spawn
public <T> ActorRef<T> spawn(Behavior<T> behavior, java.lang.String name, Props props)
See corresponding method onActorTestKit
-
createTestProbe
public <M> TestProbe<M> createTestProbe()
See corresponding method onActorTestKit
-
createTestProbe
public <M> TestProbe<M> createTestProbe(java.lang.String name)
See corresponding method onActorTestKit
-
createDroppedMessageProbe
public TestProbe<Dropped> createDroppedMessageProbe()
See corresponding method onActorTestKit
-
createDeadLetterProbe
public TestProbe<DeadLetter> createDeadLetterProbe()
See corresponding method onActorTestKit
-
createUnhandledMessageProbe
public TestProbe<UnhandledMessage> createUnhandledMessageProbe()
See corresponding method onActorTestKit
-
serializationTestKit
public SerializationTestKit serializationTestKit()
Additional testing utilities for serialization.
-
afterAll
protected abstract void afterAll()
To be implemented by "more" concrete class that can mixinBeforeAndAfterAll
or similar, for exampleFlatSpecLike with BeforeAndAfterAll
. Implement by callingtestKit.shutdownTestKit()
.
-
-