Class ActorSystemExtension
java.lang.Object
org.apache.pekko.http.javadsl.testkit.ActorSystemExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension
public class ActorSystemExtension
extends Object
implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallback
A JUnit 5 (Jupiter) Extension that manages the lifecycle of an
ActorSystem.
This is the JUnit 5 counterpart of ActorSystemResource which uses JUnit 4's
ExternalResource. It implements BeforeEachCallback and
AfterEachCallback to create and terminate the ActorSystem around each test method.
Usage with @RegisterExtension:
@RegisterExtension
ActorSystemExtension systemExtension = new ActorSystemExtension("MyTest", ConfigFactory.empty());
Or use it indirectly through JUnitJupiterRouteTest.
-
Constructor Summary
ConstructorsConstructorDescriptionActorSystemExtension(String name, com.typesafe.config.Config additionalConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidafterEach(org.junit.jupiter.api.extension.ExtensionContext context) voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context) protected com.typesafe.config.Configconfig()protected org.apache.pekko.actor.ActorSystemorg.apache.pekko.stream.Materializerorg.apache.pekko.actor.ActorSystemsystem()
-
Constructor Details
-
ActorSystemExtension
-
-
Method Details
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) - Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
config
protected com.typesafe.config.Config config() -
createSystem
protected org.apache.pekko.actor.ActorSystem createSystem() -
materializer
public org.apache.pekko.stream.Materializer materializer() -
system
public org.apache.pekko.actor.ActorSystem system()
-