taskService.complete(task1.getId());
// Completing the second task should trigger the first join
taskService.complete(task2.getId());
tasks = query.list();
Task task3 = tasks.get(0);
assertEquals(2, tasks.size());
assertEquals("Task 3", task3.getName());
Task task4 = tasks.get(1);
assertEquals("Task 4", task4.getName());