@Test (timeout=5000) public void testTaskStartTimes() { TaskId taskId = mock(TaskId.class); TaskInfo taskInfo = mock(TaskInfo.class); Map<TaskAttemptID, TaskAttemptInfo> taskAttempts = new TreeMap<TaskAttemptID, TaskAttemptInfo>(); TaskAttemptID id = new TaskAttemptID("0", 0, TaskType.MAP, 0, 0); TaskAttemptInfo info = mock(TaskAttemptInfo.class); when(info.getAttemptId()).thenReturn(id); when(info.getStartTime()).thenReturn(10l); taskAttempts.put(id, info); id = new TaskAttemptID("1", 0, TaskType.MAP, 1, 1); info = mock(TaskAttemptInfo.class); when(info.getAttemptId()).thenReturn(id); when(info.getStartTime()).thenReturn(20l); taskAttempts.put(id, info); when(taskInfo.getAllTaskAttempts()).thenReturn(taskAttempts); CompletedTask task = new CompletedTask(taskId, taskInfo); TaskReport report = task.getReport(); // Make sure the startTime returned by report is the lesser of the // attempy launch times assertTrue(report.getStartTime() == 10); }