@Test public void testEquals() throws Exception { final Host host1 = new Host("somehost", 8080); final Host host2 = new Host("somehost", 80); final Host host3 = new Host("someotherhost", 8080); final Host host4 = new Host("somehost", 80); Assert.assertTrue(host1.equals(host1)); Assert.assertFalse(host1.equals(host2)); Assert.assertFalse(host1.equals(host3)); Assert.assertTrue(host2.equals(host4)); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof Host) { final Host that = (Host) o; return this.lcName.equals(that.lcName) && this.port == that.port; } return false; }
Host implements NamedEndpoint, Serializable { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof Host) { final Host that = (Host) o; return this.lcName.equals(that.lcName) && this.port == that.port; } return false; } }
Host implements NamedEndpoint, Serializable { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof Host) { final Host that = (Host) o; return this.lcName.equals(that.lcName) && this.port == that.port; } return false; } Host(final String name, final int port); }
Host implements NamedEndpoint, Serializable { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof Host) { final Host that = (Host) o; return this.lcName.equals(that.lcName) && this.port == that.port; } return false; } Host(final String name, final int port); static Host create(final String s); @Override String getHostName(); @Override int getPort(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString(); }
Host implements NamedEndpoint, Serializable { @Override public boolean equals(final Object o) { if (this == o) { return true; } if (o instanceof Host) { final Host that = (Host) o; return this.lcName.equals(that.lcName) && this.port == that.port; } return false; } Host(final String name, final int port); static Host create(final String s); @Override String getHostName(); @Override int getPort(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }