+ supertask, 100, supertask.getCompletionPercentage());
}
public void testCompletionIs50WhenAllNestedTasksHalfCompleted() {
TaskManager taskManager = getTaskManager();
Task supertask = taskManager.createTask();
supertask.setCompletionPercentage(50);
Task task1 = taskManager.createTask();
Task task2 = taskManager.createTask();
Task task3 = taskManager.createTask();
//
GanttCalendar commonStart = new GanttCalendar(2000, 01, 01);
GanttCalendar commonEnd = new GanttCalendar(2000, 01, 05);
task1.setStart(commonStart);
task1.setEnd(commonEnd);
task2.setStart(commonStart);
task2.setEnd(commonEnd);
task3.setStart(commonStart);
task3.setEnd(commonEnd);
//
task1.move(supertask);
task2.move(supertask);
task3.move(supertask);
//
task1.setCompletionPercentage(50);
task2.setCompletionPercentage(50);
task3.setCompletionPercentage(50);
//
RecalculateTaskCompletionPercentageAlgorithm alg = taskManager
.getAlgorithmCollection()
.getRecalculateTaskCompletionPercentageAlgorithm();
alg.run(supertask);
assertEquals("Unexpected completion percentage of supertask="
+ supertask, 50, supertask.getCompletionPercentage());