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