TaskID extends org.apache.hadoop.mapred.ID { protected StringBuilder appendTo(StringBuilder builder) { return jobId.appendTo(builder). append(SEPARATOR). append(CharTaskTypeMaps.getRepresentingCharacter(type)). append(SEPARATOR). append(idFormat.format(id)); } TaskID(JobID jobId, TaskType type, int id);  TaskID(String jtIdentifier, int jobId, TaskType type, int id); @Deprecated  TaskID(JobID jobId, boolean isMap, int id); @Deprecated  TaskID(String jtIdentifier, int jobId, boolean isMap, int id);  TaskID(); JobID getJobID(); @Deprecated boolean isMap(); TaskType getTaskType(); @Override boolean equals(Object o); @Override int compareTo(ID o); @Override String toString(); @Override int hashCode(); @Override void readFields(DataInput in); @Override void write(DataOutput out); static TaskID forName(String str); static char getRepresentingCharacter(TaskType type); static TaskType getTaskType(char c); static String getAllTaskTypes(); static final String TASK_ID_REGEX; static final Pattern taskIdPattern; }
@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) { } }