@Test public void testEquals() { JmsConsumerId id1 = new JmsConsumerId(firstId, 1); JmsConsumerId id2 = new JmsConsumerId(secondId, 1); 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"))); JmsConsumerId id3 = new JmsConsumerId(firstId, 1); JmsConsumerId id4 = new JmsConsumerId(firstId, 2); JmsConsumerId id5 = new JmsConsumerId(firstId, 1); JmsConsumerId id6 = new JmsConsumerId(secondId.getConnectionId(), 1, 1); IdGenerator generator = new IdGenerator(); String connectionId = generator.generateId(); JmsConsumerId id7 = new JmsConsumerId(connectionId, 1, 2); JmsConsumerId id8 = new JmsConsumerId(connectionId, 1, 3); assertFalse(id3.equals(id4)); assertTrue(id3.equals(id5)); assertTrue(id3.equals(id6)); assertFalse(id3.equals(id7)); assertFalse(id3.equals(id8)); assertFalse(id4.equals(id7)); assertFalse(id4.equals(id8)); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != JmsConsumerId.class) { return false; } JmsConsumerId id = (JmsConsumerId) o; return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId); }
JmsConsumerId extends JmsAbstractResourceId implements Comparable<JmsConsumerId> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != JmsConsumerId.class) { return false; } JmsConsumerId id = (JmsConsumerId) o; return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId); } }
JmsConsumerId extends JmsAbstractResourceId implements Comparable<JmsConsumerId> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != JmsConsumerId.class) { return false; } JmsConsumerId id = (JmsConsumerId) o; return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId); } JmsConsumerId(String connectionId, long sessionId, long consumerId);  JmsConsumerId(JmsSessionId sessionId, long consumerId);  JmsConsumerId(JmsConsumerId consumerId);  JmsConsumerId(String consumerKey); }
JmsConsumerId extends JmsAbstractResourceId implements Comparable<JmsConsumerId> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != JmsConsumerId.class) { return false; } JmsConsumerId id = (JmsConsumerId) o; return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId); } 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); }
JmsConsumerId extends JmsAbstractResourceId implements Comparable<JmsConsumerId> { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || o.getClass() != JmsConsumerId.class) { return false; } JmsConsumerId id = (JmsConsumerId) o; return sessionId == id.sessionId && value == id.value && connectionId.equals(id.connectionId); } 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);  }