### Question:
JmsConsumerId extends JmsAbstractResourceId implements Comparable<JmsConsumerId> { @Override public int compareTo(JmsConsumerId other) { return toString().compareTo(other.toString()); } JmsConsumerId(String connectionId, long sessionId, long consumerId);  JmsConsumerId(JmsSessionId sessionId, long consumerId);  JmsConsumerId(JmsConsumerId consumerId);  JmsConsumerId(String consumerKey); JmsSessionId getParentId(); String getConnectionId(); long getSessionId(); long getValue(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); @Override int compareTo(JmsConsumerId other);  }### Answer:
@Test public void testCompareTo() { JmsConsumerId id1 = new JmsConsumerId(firstId, 1); JmsConsumerId id2 = new JmsConsumerId(secondId, 1); assertEquals(-1, id1.compareTo(id2)); assertEquals(0, id1.compareTo(id1)); assertEquals(1, id2.compareTo(id1)); }