@Test
public void updateRunningWorkflowInstanceFails() {

  WorkflowInstance i = constructWorkflowInstanceBuilder().setId(42).build();
  WorkflowInstanceAction a = new WorkflowInstanceAction.Builder().setType(externalChange).build();
  when(workflowInstanceDao.updateNotRunningWorkflowInstance(i)).thenReturn(false);
  when(workflowInstanceDao.getWorkflowInstanceType(42)).thenReturn(i.type);
  assertThat(service.updateWorkflowInstance(i, a), is(false));
  verify(workflowInstanceDao, never()).insertWorkflowInstanceAction(any(WorkflowInstance.class),
      any(WorkflowInstanceAction.class));
}