@Override
  public void write(DataOutput out) throws IOException {
    super.write(out);
    jobId.write(out);
    WritableUtils.writeEnum(out, type);
  }
@Test
  public void testWrite() throws Exception {
    JobID jobId = new JobID("1234", 1);
    TaskID taskId = new TaskID(jobId, TaskType.JOB_SETUP, 0);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(baos);

    taskId.write(out);

    DataInputByteBuffer in = new DataInputByteBuffer();
    byte[] buffer = new byte[4];

    in.reset(ByteBuffer.wrap(baos.toByteArray()));

    assertEquals("The write() method did not write the expected task ID",
        0, in.readInt());
    assertEquals("The write() method did not write the expected job ID",
        1, in.readInt());
    assertEquals("The write() method did not write the expected job "
        + "identifier length", 4, WritableUtils.readVInt(in));
    in.readFully(buffer, 0, 4);
    assertEquals("The write() method did not write the expected job "
        + "identifier length", "1234", new String(buffer));
    assertEquals("The write() method did not write the expected task type",
        TaskType.JOB_SETUP, WritableUtils.readEnum(in, TaskType.class));
  }