@Test public void exceptionIsThrown_whenResponderIsUnableToResponse() { final UserProcessController controller = mock(UserProcessController.class); when(controller.takeCurrentResponse(PausingPoint.START_KEYWORD, null)).thenReturn(Optional.empty()); final ShouldContinueEventResponder responder = mock(ShouldContinueEventResponder.class); doThrow(ResponseException.class).when(responder).respond(any(ServerResponse.class)); final ShouldContinueEvent event = new ShouldContinueEvent(responder, PausingPoint.START_KEYWORD); final ExecutionPauseContinueListener listener = new ExecutionPauseContinueListener(controller); assertThatExceptionOfType(RobotAgentEventsListenerException.class) .isThrownBy(() -> listener.handleShouldContinue(event)); }
@Override public void handleShouldContinue(final ShouldContinueEvent event) { try { final PausingPoint pausingPoint = event.getPausingPoint(); event.responder() .respond(controller.takeCurrentResponse(pausingPoint, currentlyFailedKeyword) .orElse(new ContinueExecution())); currentlyFailedKeyword = null; } catch (final ResponseException e) { throw new RobotAgentEventsListenerException("Unable to send response to client", e); } }
ExecutionPauseContinueListener extends RobotDefaultAgentEventListener { @Override public void handleShouldContinue(final ShouldContinueEvent event) { try { final PausingPoint pausingPoint = event.getPausingPoint(); event.responder() .respond(controller.takeCurrentResponse(pausingPoint, currentlyFailedKeyword) .orElse(new ContinueExecution())); currentlyFailedKeyword = null; } catch (final ResponseException e) { throw new RobotAgentEventsListenerException("Unable to send response to client", e); } } }
ExecutionPauseContinueListener extends RobotDefaultAgentEventListener { @Override public void handleShouldContinue(final ShouldContinueEvent event) { try { final PausingPoint pausingPoint = event.getPausingPoint(); event.responder() .respond(controller.takeCurrentResponse(pausingPoint, currentlyFailedKeyword) .orElse(new ContinueExecution())); currentlyFailedKeyword = null; } catch (final ResponseException e) { throw new RobotAgentEventsListenerException("Unable to send response to client", e); } } ExecutionPauseContinueListener(final UserProcessController controller); }
ExecutionPauseContinueListener extends RobotDefaultAgentEventListener { @Override public void handleShouldContinue(final ShouldContinueEvent event) { try { final PausingPoint pausingPoint = event.getPausingPoint(); event.responder() .respond(controller.takeCurrentResponse(pausingPoint, currentlyFailedKeyword) .orElse(new ContinueExecution())); currentlyFailedKeyword = null; } catch (final ResponseException e) { throw new RobotAgentEventsListenerException("Unable to send response to client", e); } } 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); }
ExecutionPauseContinueListener extends RobotDefaultAgentEventListener { @Override public void handleShouldContinue(final ShouldContinueEvent event) { try { final PausingPoint pausingPoint = event.getPausingPoint(); event.responder() .respond(controller.takeCurrentResponse(pausingPoint, currentlyFailedKeyword) .orElse(new ContinueExecution())); currentlyFailedKeyword = null; } catch (final ResponseException e) { throw new RobotAgentEventsListenerException("Unable to send response to client", e); } } 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);  }