public void testSchedule( final JavaTestKit probe, Props props, FiniteDuration startDuration, FiniteDuration afterRestartDuration) { Iterable<akka.testkit.EventFilter> filter = Arrays.asList( new akka.testkit.EventFilter[] { (akka.testkit.EventFilter) new ErrorFilter(ArithmeticException.class) }); try { system.eventStream().publish(new Mute(filter)); final ActorRef actor = system.actorOf(props); new Within(startDuration) { protected void run() { probe.expectMsgEquals("tick"); probe.expectMsgEquals("tick"); probe.expectMsgEquals("tick"); } }; actor.tell("restart", getRef()); new Within(afterRestartDuration) { protected void run() { probe.expectMsgEquals("tick"); probe.expectMsgEquals("tick"); } }; system.stop(actor); } finally { system.eventStream().publish(new UnMute(filter)); } }
@AfterClass public static void tearDown() { system.shutdown(); }
@BeforeClass public static void setUp() { system = ActorSystem.create("SchedulerPatternTest", AkkaSpec.testConf()); }