@Test
public void testAppendTo() {

  JobID jobId = new JobID("1234", 1);
  StringBuilder builder = new StringBuilder();
  for (TaskType type : TaskType.values()) {
    builder.setLength(0);
    TaskID taskId = new TaskID(jobId, type, 0);
    String str = String.format("_1234_0001_%c_000000",
        TaskID.getRepresentingCharacter(type));
    assertEquals("The appendTo() method appended the wrong value",
        str, taskId.appendTo(builder).toString());
  }
  try {
    new TaskID().appendTo(null);
    fail("The appendTo() method allowed a null builder");
  } catch (NullPointerException ex) {
    // Expected
  }
}