jeudi 12 novembre 2015

Testing Akka. Check that JavaTestKit probe received PoisonPill message

I test my actor system and I need to verify that actor sends PoisonPill message in some scenario. I mock target actor with JavaTestKit probe and try to check that it receives PoisonPill. But it doesn't work:

ActorSystem system = ActorSystem.create();
JavaTestKit probe = new JavaTestKit(system);
probe.getRef().tell(PoisonPill.getInstance(), ActorRef.noSender());
Object o = probe.expectMsgClass(FiniteDuration.apply(1000, TimeUnit.MILLISECONDS), Object.class);
//here we get exception

Is there any way to check that probe is terminated?

Aucun commentaire:

Enregistrer un commentaire