I am new to lagom and I currently try to write a unit test for one of my PersistentEntity
.
The constructor looks like this:
class EventEntity(persistentEntityRegistry: PersistentEntityRegistry)(implicit ex: ExecutionContext)
I am using the PersistentEntityRegistry
in one of my command handlers to initialize/create another entity.
My questions:
- Is this the correct/idiomatic way to create new entities? So, is it ok to create one entity from within another? or should I better do this in the
ServiceImpl
layer after I received the reply from the command? - If this is the way to go, how would I unit test this?