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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -