### Question:
MRApps extends Apps { public static TaskId toTaskID(String tid) { Iterator<String> it = _split(tid).iterator(); return toTaskID(TASK, tid, it); }  static String toString(JobId jid); static JobId toJobID(String jid); static JobId toJobID(String prefix, String s, Iterator<String> it); static String toString(TaskId tid); static TaskId toTaskID(String tid); static TaskId toTaskID(String prefix, String s, Iterator<String> it); static String toString(TaskAttemptId taid); static TaskAttemptId toTaskAttemptID(String taid); static String taskSymbol(TaskType type); static TaskType taskType(String symbol); static TaskAttemptStateUI taskAttemptState(String attemptStateStr); static void setInitialClasspath(
      Map<String, String> environment); static void addToClassPath(
      Map<String, String> environment, String fileName); static Path getStagingAreaDir(Configuration conf, String user); static String getJobFile(Configuration conf, String user, 
      org.apache.hadoop.mapreduce.JobID jobId); static final String JOB; static final String TASK; static final String ATTEMPT; static final String CLASSPATH; }### Answer:
@Test public void testToTaskID() { TaskId tid = MRApps.toTaskID("task_1_2_3_r_4"); assertEquals(1, tid.getJobId().getAppId().getClusterTimestamp()); assertEquals(2, tid.getJobId().getAppId().getId()); assertEquals(3, tid.getJobId().getId()); assertEquals(TaskType.REDUCE, tid.getTaskType()); assertEquals(4, tid.getId()); tid = MRApps.toTaskID("task_1_2_3_m_4"); assertEquals(TaskType.MAP, tid.getTaskType()); }
@Test(expected=YarnException.class) public void testTaskIDShort() { MRApps.toTaskID("task_0_0_0_m"); }
@Test(expected=YarnException.class) public void testTaskIDBadType() { MRApps.toTaskID("task_0_0_0_x_0"); }