### Question:
TaskKey extends JobKey implements Comparable<Object> { public String getTaskId() { return this.taskId; } @JsonCreator  TaskKey(@JsonProperty("jobId") JobKey jobKey, @JsonProperty("taskId") String taskId); String getTaskId(); String toString(); @Override int compareTo(Object other); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void testSerialization() { TaskKeyConverter conv = new TaskKeyConverter(); TaskKey key1 = new TaskKey( new JobKey("test@local", "testuser", "app", 1234L, "job_20120101000000_1111"), "m_001"); assertEquals("test@local", key1.getCluster()); assertEquals("testuser", key1.getUserName()); assertEquals("app", key1.getAppId()); assertEquals(1234L, key1.getRunId()); assertEquals("job_20120101000000_1111", key1.getJobId().getJobIdString()); assertEquals("m_001", key1.getTaskId()); byte[] key1Bytes = conv.toBytes(key1); TaskKey key2 = conv.fromBytes(key1Bytes); assertKey(key1, key2); TaskKey key3 = conv.fromBytes( conv.toBytes(key2) ); assertKey(key1, key3); long now = System.currentTimeMillis(); byte[] encoded = Bytes.toBytes(Long.MAX_VALUE - now); Bytes.putBytes(encoded, encoded.length-Constants.SEP_BYTES.length, Constants.SEP_BYTES, 0, Constants.SEP_BYTES.length); long badId = Long.MAX_VALUE - Bytes.toLong(encoded); LOG.info("Bad run ID is " + badId); TaskKey badKey1 = new TaskKey( new JobKey(key1.getQualifiedJobId(), key1.getUserName(), key1.getAppId(), badId), key1.getTaskId()); byte[] badKeyBytes = conv.toBytes(badKey1); TaskKey badKey2 = conv.fromBytes(badKeyBytes); assertKey(badKey1, badKey2); }