@Test
public void testDecideSuccessfulWorkflow() {

    WorkflowDef workflowDef = createLinearWorkflow();
    Workflow workflow = new Workflow();
    workflow.setWorkflowDefinition(workflowDef);
    workflow.setStatus(WorkflowStatus.RUNNING);
    Task task1 = new Task();
    task1.setTaskType("junit_task_l1");
    task1.setReferenceTaskName("s1");
    task1.setSeq(1);
    task1.setRetried(false);
    task1.setExecuted(false);
    task1.setStatus(Status.COMPLETED);
    workflow.getTasks().add(task1);
    DeciderOutcome deciderOutcome = deciderService.decide(workflow);
    assertNotNull(deciderOutcome);
    assertFalse(workflow.getTaskByRefName("s1").isRetried());
    assertEquals(1, deciderOutcome.tasksToBeUpdated.size());
    assertEquals("s1", deciderOutcome.tasksToBeUpdated.get(0).getReferenceTaskName());
    assertEquals(1, deciderOutcome.tasksToBeScheduled.size());
    assertEquals("s2", deciderOutcome.tasksToBeScheduled.get(0).getReferenceTaskName());
    assertFalse(deciderOutcome.isComplete);
    Task task2 = new Task();
    task2.setTaskType("junit_task_l2");
    task2.setReferenceTaskName("s2");
    task2.setSeq(2);
    task2.setRetried(false);
    task2.setExecuted(false);
    task2.setStatus(Status.COMPLETED);
    workflow.getTasks().add(task2);
    deciderOutcome = deciderService.decide(workflow);
    assertNotNull(deciderOutcome);
    assertTrue(workflow.getTaskByRefName("s2").isExecuted());
    assertFalse(workflow.getTaskByRefName("s2").isRetried());
    assertEquals(1, deciderOutcome.tasksToBeUpdated.size());
    assertEquals("s2", deciderOutcome.tasksToBeUpdated.get(0).getReferenceTaskName());
    assertEquals(0, deciderOutcome.tasksToBeScheduled.size());
    assertTrue(deciderOutcome.isComplete);
}