@SuppressWarnings("unchecked")
@Test
public void fetchingExistingWorkflowWorks() {

  WorkflowInstance instance = mock(WorkflowInstance.class);
  when(workflowInstances.getWorkflowInstance(42, emptySet(), null)).thenReturn(instance);
  ListWorkflowInstanceResponse resp = mock(ListWorkflowInstanceResponse.class);
  when(listWorkflowConverter.convert(eq(instance), any(Set.class))).thenReturn(resp);
  ListWorkflowInstanceResponse result = resource.fetchWorkflowInstance(42, null, null).readEntity(ListWorkflowInstanceResponse.class);
  verify(workflowInstances).getWorkflowInstance(42, emptySet(), null);
  assertEquals(resp, result);
}