@Test public void endpointEquality() { Endpoint q1 = new Endpoint(Endpoint.Type.QUEUE, "foo"); Endpoint q1Dup = new Endpoint(Endpoint.Type.QUEUE, "foo"); Endpoint t1 = new Endpoint(Endpoint.Type.TOPIC, "foo"); Endpoint t1Dup = new Endpoint(Endpoint.Type.TOPIC, "foo"); Endpoint q2 = new Endpoint(Endpoint.Type.QUEUE, "bar"); Endpoint t2 = new Endpoint(Endpoint.Type.TOPIC, "bar"); assertTrue(q1.equals(q1Dup)); assertTrue(t1.equals(t1Dup)); assertFalse(q1.equals(q2)); assertFalse(q1.equals(t1)); assertFalse(q1.equals(t2)); assertFalse(t1.equals(t2)); assertFalse(t1.equals(q1)); assertFalse(t1.equals(q2)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Endpoint)) { return false; } Endpoint other = (Endpoint) obj; if (type != other.type) { return false; } if (!name.equals(other.name)) { return false; } if (isTemp != other.isTemp) { return false; } return true; }
Endpoint { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Endpoint)) { return false; } Endpoint other = (Endpoint) obj; if (type != other.type) { return false; } if (!name.equals(other.name)) { return false; } if (isTemp != other.isTemp) { return false; } return true; } }
Endpoint { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Endpoint)) { return false; } Endpoint other = (Endpoint) obj; if (type != other.type) { return false; } if (!name.equals(other.name)) { return false; } if (isTemp != other.isTemp) { return false; } return true; } Endpoint(String destination);  Endpoint(Type type, String name);  Endpoint(Type type, String name, boolean isTemp); }
Endpoint { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Endpoint)) { return false; } Endpoint other = (Endpoint) obj; if (type != other.type) { return false; } if (!name.equals(other.name)) { return false; } if (isTemp != other.isTemp) { return false; } return true; } Endpoint(String destination);  Endpoint(Type type, String name);  Endpoint(Type type, String name, boolean isTemp); Type getType(); String getName(); boolean isTemporary(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
Endpoint { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Endpoint)) { return false; } Endpoint other = (Endpoint) obj; if (type != other.type) { return false; } if (!name.equals(other.name)) { return false; } if (isTemp != other.isTemp) { return false; } return true; } Endpoint(String destination);  Endpoint(Type type, String name);  Endpoint(Type type, String name, boolean isTemp); Type getType(); String getName(); boolean isTemporary(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final Endpoint TEMPORARY_QUEUE; static final Endpoint TEMPORARY_TOPIC; }