@Test
public void testEquals() {

  JobID jobId1 = new JobID("1234", 1);
  JobID jobId2 = new JobID("2345", 2);
  TaskID taskId1 = new TaskID(jobId1, TaskType.MAP, 0);
  TaskID taskId2 = new TaskID(jobId1, TaskType.MAP, 0);
  assertTrue("The equals() method reported two equal task IDs were not equal",
      taskId1.equals(taskId2));
  taskId2 = new TaskID(jobId2, TaskType.MAP, 0);
  assertFalse("The equals() method reported two task IDs with different "
      + "job IDs were equal", taskId1.equals(taskId2));
  taskId2 = new TaskID(jobId1, TaskType.MAP, 1);
  assertFalse("The equals() method reported two task IDs with different IDs "
      + "were equal", taskId1.equals(taskId2));
  TaskType[] types = TaskType.values();
  for (int i = 0; i < types.length; i++) {
    for (int j = 0; j < types.length; j++) {
      taskId1 = new TaskID(jobId1, types[i], 0);
      taskId2 = new TaskID(jobId1, types[j], 0);
      if (i == j) {
        assertTrue("The equals() method reported two equal task IDs were not "
            + "equal", taskId1.equals(taskId2));
      } else {
        assertFalse("The equals() method reported two task IDs with "
            + "different types were equal", taskId1.equals(taskId2));
      }
    }
  }
  assertFalse("The equals() method matched against a JobID object",
      taskId1.equals(jobId1));
  assertFalse("The equals() method matched against a null object",
      taskId1.equals(null));
}