### Question:
AllocationCompletionTracker { ImmutableList<String> getUnfinishedLeafTasks() { List<Allocation> allUnfinished = getUnfinishedAllocations(); Set<Allocation> unfinishedLeaves = new LinkedHashSet<>(allUnfinished); for (Allocation allocation : allUnfinished) { Optional<Allocation> parent = allocation.getParent(); while (parent.isPresent()) { unfinishedLeaves.remove(parent.get()); parent = parent.get().getParent(); } } return ImmutableList.copyOf( unfinishedLeaves.stream().map(Allocation::getDescription).collect(Collectors.toList())); }    }### Answer:
@Test public void testGetUnfinishedLeafTasks() { AllocationCompletionTracker tracker = new AllocationCompletionTracker(); tracker.updateProgress(AllocationTree.root, 0); Assert.assertEquals(Arrays.asList("root"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child1, 0); Assert.assertEquals(Arrays.asList("child1"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child2, 0); Assert.assertEquals(Arrays.asList("child1", "child2"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child1Child, 0); Assert.assertEquals(Arrays.asList("child2", "child1Child"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child1Child, 50); Assert.assertEquals(Arrays.asList("child2", "child1Child"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child2, 100); Assert.assertEquals(Arrays.asList("child2", "child1Child"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child2, 100); Assert.assertEquals(Arrays.asList("child1Child"), tracker.getUnfinishedLeafTasks()); tracker.updateProgress(AllocationTree.child1Child, 50); Assert.assertEquals(Collections.emptyList(), tracker.getUnfinishedLeafTasks()); }