Hi all,
When writing PE tests, I like to be thorough about my assumptions and challenge that there are no issues that arise from my commands and responses.
My PE fixture looks like this:
private val system = ActorSystem("FooSpec", JsonSerializerRegistry.actorSystemSetupFor(FooSerializerRegistry))
def withDriver(testCode: PersistentEntityTestDriver[FooEntityCommand, api.FooEvent, FooState] => Any): Unit = {
val driver = new PersistentEntityTestDriver(system, new FooEntity, "driver")
try {
testCode(driver)
} finally {
driver.getAllIssues shouldBe empty
}
}
I find that when I respond with collections, I run into errors serializing helper classes of various common collections, seen below:
- No serializer defined for class scala.collection.immutable.Map$EmptyMap$
- class scala.collection.immutable.Set$EmptySet$ is not serializable
- class scala.collection.immutable.Set$Set1 is not serializable
I’ve registered all parameter types in my JsonSerializerRegistry
, but I still see this issue, failing my tests and my application.conf
looks like this
akka.actor.serialization-bindings {
"akka.Done" = akka-misc
}
Is this a bug in play-json, Lagom, neither, or both?
Lagom attempts to get the manifest class
scala> final case class Foo(s: String)
defined class Foo
scala> Set.empty[Foo].getClass.getName
res22: String = scala.collection.immutable.Set$EmptySet$
But a serializer for this hasn’t been registered. Should Lagom get the enclosing class instead, which would resolve to scala.collection.immutable.Set[Foo]
, which does indeed have a format?