WorkflowResource { private Response<WorkflowWithState> workflowWithState(String componentId, String id) { var workflowId = WorkflowId.create(componentId, id); try { return storage.workflowWithState(workflowId) .map(Response::forPayload) .orElse(Response.forStatus(Status.NOT_FOUND)); } catch (IOException e) { throw new RuntimeException("Failed get workflow " + workflowId.toKey(), e); } } WorkflowResource(Storage storage, WorkflowValidator workflowValidator,
                          WorkflowInitializer workflowInitializer,
                          BiConsumer<Optional<Workflow>, Optional<Workflow>> workflowConsumer,
                          WorkflowActionAuthorizer workflowActionAuthorizer); Stream<Route<AsyncHandler<Response<ByteString>>>> routes(RequestAuthenticator requestAuthenticator);  }
@Test public void shouldFailToReturnWorkflowWithState() throws Exception { sinceVersion(Api.Version.V3); when(storage.workflowWithState(WorkflowId.create("foo", "bar"))).thenThrow(new IOException()); Response<ByteString> response = awaitResponse( serviceHelper.request("GET", path("/foo/bar/full"))); assertThat(response, hasStatus(withCode(Status.INTERNAL_SERVER_ERROR))); }