testing - How to kill and restart an akka persistent actor in unit test to see if it retains state -


in unit tests, there way kill , restart persistent actor check whether can retain state (and that, instance, event serialisation/deserialisation works fine)?

// initialize actor , probe actor  val probe = testprobe() val act = system.actorof(props[myactor], "name")  // send messages actor change state // validate state has changed  // send message terminate actor act ! poisonpill  // wait actor shutdown  probe.watch(act) probe.expectterminated(act)  // initialize new probe , new instance of actor, assumption  // actor has same persistence id initial one. // actor should in same state before.   val probetwo = testprobe() val rehydrated = system.actorof(props[myactor], "name")  // validate state of actor.  // todo: put validation checks here 

here useful information on how test actors.


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -