@Test
public void testReadFields() throws Exception {

  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  DataOutputStream out = new DataOutputStream(baos);
  out.writeInt(0);
  out.writeInt(1);
  WritableUtils.writeVInt(out, 4);
  out.write(new byte[] {0x31, 0x32, 0x33, 0x34});
  WritableUtils.writeEnum(out, TaskType.REDUCE);
  DataInputByteBuffer in = new DataInputByteBuffer();
  in.reset(ByteBuffer.wrap(baos.toByteArray()));
  TaskID instance = new TaskID();
  instance.readFields(in);
  assertEquals("The readFields() method did not produce the expected task ID",
      "task_1234_0001_r_000000", instance.toString());
}