@Test
public void testDecideFailedTask() {

    WorkflowDef workflowDef = createLinearWorkflow();
    Workflow workflow = new Workflow();
    workflow.setWorkflowDefinition(workflowDef);
    workflow.setStatus(WorkflowStatus.RUNNING);
    Task task = new Task();
    task.setTaskType("junit_task_l1");
    task.setReferenceTaskName("s1");
    task.setSeq(1);
    task.setRetried(false);
    task.setExecuted(false);
    task.setStatus(Status.FAILED);
    WorkflowTask workflowTask = new WorkflowTask();
    workflowTask.setTaskReferenceName("s1");
    workflowTask.setName("junit_task_l1");
    workflowTask.setTaskDefinition(new TaskDef("junit_task_l1"));
    task.setWorkflowTask(workflowTask);
    workflow.getTasks().add(task);
    DeciderOutcome deciderOutcome = deciderService.decide(workflow);
    assertNotNull(deciderOutcome);
    assertFalse(workflow.getTaskByRefName("s1").isExecuted());
    assertTrue(workflow.getTaskByRefName("s1").isRetried());
    assertEquals(1, deciderOutcome.tasksToBeUpdated.size());
    assertEquals("s1", deciderOutcome.tasksToBeUpdated.get(0).getReferenceTaskName());
    assertEquals(1, deciderOutcome.tasksToBeScheduled.size());
    assertEquals("s1", deciderOutcome.tasksToBeScheduled.get(0).getReferenceTaskName());
    assertFalse(deciderOutcome.isComplete);
}