@Test public final void testEquals() { DummyClientDescription clientDesc1 = new DummyClientDescription("type_1"); DummyClientDescription clientDesc2 = new DummyClientDescription("type_1"); DummyClientDescription clientDesc3 = new DummyClientDescription("type_other"); Assert.assertEquals(clientDesc1, clientDesc1); Assert.assertEquals(clientDesc1, clientDesc2); Assert.assertNotEquals(clientDesc1, clientDesc3); Assert.assertNotEquals(clientDesc1, null); Assert.assertNotEquals(clientDesc1, new Object()); Assert.assertEquals(clientDesc1.hashCode(), clientDesc1.hashCode()); Assert.assertEquals(clientDesc1.hashCode(), clientDesc2.hashCode()); Assert.assertNotEquals(clientDesc1.hashCode(), clientDesc3.hashCode()); }
@Override public boolean equals(Object other) { if (!(other instanceof ClientDescription)) return false; if (other == this) return true; ClientDescription client = (ClientDescription) other; return Objects.equal(type, client.type); }
ClientDescription { @Override public boolean equals(Object other) { if (!(other instanceof ClientDescription)) return false; if (other == this) return true; ClientDescription client = (ClientDescription) other; return Objects.equal(type, client.type); } }
ClientDescription { @Override public boolean equals(Object other) { if (!(other instanceof ClientDescription)) return false; if (other == this) return true; ClientDescription client = (ClientDescription) other; return Objects.equal(type, client.type); } protected  ClientDescription(String type); }
ClientDescription { @Override public boolean equals(Object other) { if (!(other instanceof ClientDescription)) return false; if (other == this) return true; ClientDescription client = (ClientDescription) other; return Objects.equal(type, client.type); } protected  ClientDescription(String type); final String getType(); @Override boolean equals(Object other); @Override int hashCode(); abstract R accept(ClientDescriptionVisitor<P,R> visitor, P param); }
ClientDescription { @Override public boolean equals(Object other) { if (!(other instanceof ClientDescription)) return false; if (other == this) return true; ClientDescription client = (ClientDescription) other; return Objects.equal(type, client.type); } protected  ClientDescription(String type); final String getType(); @Override boolean equals(Object other); @Override int hashCode(); abstract R accept(ClientDescriptionVisitor<P,R> visitor, P param);  }