WorkflowResource { private Response<Collection<Workflow>> workflows() { try { return Response.forPayload(storage.workflows().values()); } catch (IOException e) { throw new RuntimeException("Failed to get workflows", 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 shouldFailToReturnWorkflowsInComponent() throws Exception { sinceVersion(Api.Version.V3); when(storage.workflows("foo")).thenThrow(new IOException()); Response<ByteString> response = awaitResponse( serviceHelper.request("GET", path("/foo"))); assertThat(response, hasStatus(withCode(Status.INTERNAL_SERVER_ERROR))); }
@Test public void shouldFailedToReturnWorkflows() throws Exception { sinceVersion(Api.Version.V3); when(storage.workflows()).thenThrow(new IOException()); Response<ByteString> response = awaitResponse( serviceHelper.request("GET", path(""))); assertThat(response, hasStatus(withCode(Status.INTERNAL_SERVER_ERROR))); }