task.restoreFromEvent(new TaskStartedEvent(taskId, "v1", 0, 0));
for (int i = 0; i < maxFailedAttempts - 1; ++i) {
TezTaskAttemptID attemptId = getNewTaskAttemptID(lastTaskId);
task.restoreFromEvent(new TaskAttemptStartedEvent(attemptId, "v1", 0,
mockContainerId, mockNodeId, "", ""));
task.restoreFromEvent(new TaskAttemptFinishedEvent(attemptId, "v1", 0, 0,
TaskAttemptState.FAILED, "", null));
}
assertEquals(maxFailedAttempts - 1, task.getAttempts().size());
assertEquals(maxFailedAttempts - 1, task.failedAttempts);