0

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){
user_1357
  • 7,766
  • 13
  • 63
  • 106

1 Answers1

1

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.

artur
  • 1,710
  • 1
  • 13
  • 28
  • Do you happen to know how to increase the timeout for the testkit? https://stackoverflow.com/questions/65133027/how-to-increase-default-timeout-for-scalatestwithactortestkit – user_1357 Dec 03 '20 at 19:45