EventSourcedBehaviorTestKit

org.apache.pekko.persistence.testkit.javadsl.EventSourcedBehaviorTestKit
See theEventSourcedBehaviorTestKit companion class

Testing of pekko.persistence.typed.javadsl.EventSourcedBehavior implementations. It supports running one command at a time and you can assert that the synchronously returned result is as expected. The result contains the events emitted by the command and the new state after applying the events. It also has support for verifying the reply to a command.

Serialization of commands, events and state are verified automatically.

Attributes

Companion
class
Source
EventSourcedBehaviorTestKit.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

class CommandResult[Command, Event, State](delegate: CommandResult[Command, Event, State])

The result of running a command.

The result of running a command.

Attributes

Source
EventSourcedBehaviorTestKit.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class CommandResultWithReply[Command, Event, State, Reply]
final class CommandResultWithReply[Command, Event, State, Reply](delegate: CommandResultWithReply[Command, Event, State, Reply]) extends CommandResult[Command, Event, State]

The result of running a command with a ActorRef<R> replyTo, i.e. the runCommand with a Function<ActorRef<R>, Command> parameter.

The result of running a command with a ActorRef<R> replyTo, i.e. the runCommand with a Function<ActorRef<R>, Command> parameter.

Attributes

Source
EventSourcedBehaviorTestKit.scala
Supertypes
class CommandResult[Command, Event, State]
class Object
trait Matchable
class Any
final class RestartResult[State](delegate: RestartResult[State])

The result of restarting the behavior.

The result of restarting the behavior.

Attributes

Source
EventSourcedBehaviorTestKit.scala
Supertypes
class Object
trait Matchable
class Any
final class SerializationSettings(val enabled: Boolean, val verifyEquality: Boolean, val verifyCommands: Boolean, val verifyEvents: Boolean, val verifyState: Boolean)

Customization of which serialization checks that are performed. equals must be implemented (or using case class) when verifyEquality is enabled.

Customization of which serialization checks that are performed. equals must be implemented (or using case class) when verifyEquality is enabled.

Attributes

Source
EventSourcedBehaviorTestKit.scala
Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

def create[Command, Event, State](system: ActorSystem[_], behavior: Behavior[Command]): EventSourcedBehaviorTestKit[Command, Event, State]

Factory method to create a new EventSourcedBehaviorTestKit.

Factory method to create a new EventSourcedBehaviorTestKit.

Attributes

Source
EventSourcedBehaviorTestKit.scala
def create[Command, Event, State](system: ActorSystem[_], behavior: Behavior[Command], serializationSettings: SerializationSettings): EventSourcedBehaviorTestKit[Command, Event, State]

Factory method to create a new EventSourcedBehaviorTestKit with custom SerializationSettings.

Factory method to create a new EventSourcedBehaviorTestKit with custom SerializationSettings.

Note that equals must be implemented in the commands, events and state if verifyEquality is enabled.

Attributes

Source
EventSourcedBehaviorTestKit.scala

Concrete fields

val config: Config

The configuration to be included in the configuration of the ActorSystem. Typically used as constructor parameter to TestKitJunitResource. The configuration enables the in-memory journal and snapshot storage.

The configuration to be included in the configuration of the ActorSystem. Typically used as constructor parameter to TestKitJunitResource. The configuration enables the in-memory journal and snapshot storage.

Attributes

Source
EventSourcedBehaviorTestKit.scala