@Test
public void testFilterNextLoopOverTasks() {

    Workflow workflow = new Workflow();
    Task task1 = new Task();
    task1.setReferenceTaskName("task1");
    task1.setStatus(Status.COMPLETED);
    task1.setTaskId("task1");
    task1.setIteration(1);
    Task task2 = new Task();
    task2.setReferenceTaskName("task2");
    task2.setStatus(Status.SCHEDULED);
    task2.setTaskId("task2");
    Task task3 = new Task();
    task3.setReferenceTaskName("task3__1");
    task3.setStatus(Status.IN_PROGRESS);
    task3.setTaskId("task3__1");
    Task task4 = new Task();
    task4.setReferenceTaskName("task4");
    task4.setStatus(Status.SCHEDULED);
    task4.setTaskId("task4");
    Task task5 = new Task();
    task5.setReferenceTaskName("task5");
    task5.setStatus(Status.COMPLETED);
    task5.setTaskId("task5");
    workflow.getTasks().addAll(Arrays.asList(task1, task2, task3, task4, task5));
    List<Task> tasks = deciderService.filterNextLoopOverTasks(Arrays.asList(task2, task3, task4), task1, workflow);
    assertEquals(2, tasks.size());
    tasks.forEach(task -> {
        assertTrue(task.getReferenceTaskName().endsWith(TaskUtils.getLoopOverTaskRefNameSuffix(1)));
        assertEquals(1, task.getIteration());
    });
}