@Test
public void shouldFailToPatchStateOfNonexistWorkflow() throws Exception {

  sinceVersion(Api.Version.V3);
  doThrow(new ResourceNotFoundException(""))
      .when(storage).patchState(WorkflowId.create("foo", "bar"), WorkflowState.patchEnabled(true));
  Response<ByteString> response =
      awaitResponse(serviceHelper.request("PATCH", path("/foo/bar/state"),
          STATEPAYLOAD_ENABLED));
  assertThat(response, hasStatus(withCode(Status.NOT_FOUND)));
}