I am trying out EventSourcedBehaviorTestKit
using documentation
as a guidance. I used following configuration ScalaTestWithActorTestKit(EventSourcedBehaviorTestKit.config)
which uses DisableJavaSerializer due to akka.actor.allow-java-serialization = off
which requires me to override the config in order to test without having to specify serializer. Currently I am having to do below in order to use JavaSerializer. Is this behavior expected? What is an expected configuration for this type of test?
class SomeSpec extends ScalaTestWithActorTestKit(
ConfigFactory.parseString("""
akka.persistence.testkit.events.serialize = off
akka.actor.allow-java-serialization = on
""").withFallback(PersistenceTestKitPlugin.config){
You can simplify the config a bit by using:
class SomeSpec extends ScalaTestWithActorTestKit(
ConfigFactory.parseString("akka.actor.allow-java-serialization = on")
.withFallback(EventSourcedBehaviorTestKit.config){
That Config
is internally passed to ActorTestKit
's constructor so any configuration you need you should add here. I use this to set Jackson
serializer in my test.