@Override
  public boolean execute(Workflow workflow, Task task, WorkflowExecutor executor) {
    Map<String, Task> taskMap = TaskHelper.getTaskMap(workflow);
    Optional<Task.Status> done = executeJoin(task, taskMap);
    if (done.isPresent() && confirmDone(workflow, task)) { // update task status if it is done
      task.setStatus(done.get());
      return true;
    }
    return false;
  }
@Test
  public void testExecuteIncomplete() {
    StepRuntimeState state = new StepRuntimeState();
    state.setStatus(StepInstance.Status.FATALLY_FAILED);
    when(stepInstanceDao.getStepStates(anyString(), anyLong(), anyLong(), anyList()))
        .thenReturn(Collections.singletonMap("job1", state));

    assertFalse(gateTask.execute(workflow, joinTask, null));
    assertNull(joinTask.getStatus());
  }