### Question:
JmsSessionId extends JmsAbstractResourceId implements Comparable<JmsSessionId> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != JmsSessionId.class) { return false; } JmsSessionId id = (JmsSessionId)o; return value == id.value && connectionId.equals(id.connectionId); } JmsSessionId(String connectionId, long value);  JmsSessionId(JmsConnectionId connectionId, long sessionId);  JmsSessionId(JmsSessionId id);  JmsSessionId(JmsProducerId id);  JmsSessionId(JmsConsumerId id); JmsConnectionId getParentId(); @Override int hashCode(); @Override boolean equals(Object o); String getConnectionId(); long getValue(); @Override String toString(); @Override int compareTo(JmsSessionId other);  }### Answer:
@Test public void testEquals() { JmsSessionId id1 = new JmsSessionId(firstId, 1); JmsSessionId id2 = new JmsSessionId(secondId, 2); assertTrue(id1.equals(id1)); assertTrue(id2.equals(id2)); assertFalse(id1.equals(id2)); assertFalse(id2.equals(id1)); assertFalse(id1.equals(null)); assertFalse(id1.equals(new String("TEST"))); JmsSessionId id3 = new JmsSessionId(firstId, 1); JmsSessionId id4 = new JmsSessionId(firstId, 2); JmsSessionId id5 = new JmsSessionId(firstId, 1); IdGenerator generator = new IdGenerator(); String connectionId = generator.generateId(); JmsSessionId id6 = new JmsSessionId(connectionId, 1); JmsSessionId id7 = new JmsSessionId(connectionId, 3); assertFalse(id3.equals(id4)); assertTrue(id3.equals(id5)); assertFalse(id3.equals(id6)); assertFalse(id3.equals(id7)); assertFalse(id4.equals(id6)); assertFalse(id4.equals(id7)); }