ExecutionPauseContinueListener extends RobotDefaultAgentEventListener { @Override public void handlePaused(final PausedEvent event) { controller.executionPaused(); event.responder().respondAsynchronously(controller.takeFutureResponse(), new ResumeExecution()); } ExecutionPauseContinueListener(final UserProcessController controller); @Override void handleKeywordAboutToEnd(final KeywordEndedEvent event); @Override void handleShouldContinue(final ShouldContinueEvent event); @Override void handlePaused(final PausedEvent event); @Override void handleConditionEvaluated(final ConditionEvaluatedEvent event);  }
@Test public void controllerIsNotifiedAndFutureResponseIsScheduled_whenAgentPauseOccurs() { final FutureTask<ServerResponse> task = new FutureTask<>(() -> null); final UserProcessController controller = mock(UserProcessController.class); when(controller.takeFutureResponse()).thenReturn(task); final PausedEventResponder responder = mock(PausedEventResponder.class); final PausedEvent event = new PausedEvent(responder); final ExecutionPauseContinueListener listener = new ExecutionPauseContinueListener(controller); listener.handlePaused(event); verify(controller).executionPaused(); verify(responder).respondAsynchronously(same(task), any(ResumeExecution.class)); }