### Question:
JobKey extends FlowKey implements Comparable<Object> { @Override public int compareTo(Object other) { if (other == null) { return -1; } JobKey otherKey = (JobKey)other; return new CompareToBuilder().appendSuper(super.compareTo(otherKey)) .append(this.jobId, otherKey.getJobId()) .toComparison(); } JobKey(String cluster, String userName, String appId, long runId,
      String jobId); @JsonCreator  JobKey(@JsonProperty("cluster") String cluster,
                @JsonProperty("userName") String userName,
                @JsonProperty("appId") String appId,
                @JsonProperty("runId") long runId,
                @JsonProperty("jobId") JobId jobId);  JobKey(QualifiedJobId qualifiedJobId, String userName, String appId,
      long runId);  JobKey(JobDesc jobDesc); QualifiedJobId getQualifiedJobId(); JobId getJobId(); String toString(); @Override int compareTo(Object other); @Override boolean equals(Object other); @Override int hashCode();  }### Answer:
@Test public void testOrdering() { JobKey key1 = new JobKey("c1@local", "auser", "app", 1234L, "job_20120101000000_0001"); JobKey key2 = new JobKey("c1@local", "auser", "app", 1234L, "job_20120101000000_2222"); JobKey key3 = new JobKey("c1@local", "auser", "app", 1234L, "job_20120101000000_11111"); JobKey key4 = new JobKey("c1@local", "auser", "app", 1345L, "job_20120101000000_0001"); JobKeyConverter conv = new JobKeyConverter(); byte[] key1Bytes = conv.toBytes(key1); byte[] key2Bytes = conv.toBytes(key2); byte[] key3Bytes = conv.toBytes(key3); byte[] key4Bytes = conv.toBytes(key4); assertTrue(Bytes.compareTo(key4Bytes, key1Bytes) < 0); assertTrue(Bytes.compareTo(key1Bytes, key2Bytes) < 0); assertTrue(Bytes.compareTo(key2Bytes, key3Bytes) < 0); }