UserProcessController { public FutureTask<ServerResponse> takeFutureResponse() { return new FutureTask<>(() -> { final ResponseWithCallback currentResponse = manualUserResponse.take(); currentResponse.callback.run(); return currentResponse.response; }); }  void executionPaused(); void conditionEvaluated(@SuppressWarnings("unused") final ConditionEvaluatedEvent event); @SuppressWarnings("unused") Optional<ServerResponse> takeCurrentResponse(final PausingPoint pausingPoint,
            final QualifiedKeywordName currentlyFailedKeyword); FutureTask<ServerResponse> takeFutureResponse(); void disconnect(final Runnable whenResponseIsSent); void interrupt(final Runnable whenResponseIsSent); void terminate(final Runnable whenResponseIsSent); void pause(final Runnable whenResponseIsSent); void resume(final Runnable whenResponseIsSent);  }
@Test public void whenFutureResponseWasOrdered_itIsReturnedAsFutureTask() throws Exception { final Runnable callback = mock(Runnable.class); final UserProcessController controller = new UserProcessController(); final ServerResponse response = () -> "response"; controller.manualUserResponse.put(new ResponseWithCallback(response, callback)); final FutureTask<ServerResponse> futureResponse = controller.takeFutureResponse(); assertThat(controller.manualUserResponse).hasSize(1); futureResponse.run(); assertThat(controller.manualUserResponse).isEmpty(); verify(callback).run(); }