@Test public void testEquals() throws Exception { final URIAuthority host1 = new URIAuthority("somehost", 8080); final URIAuthority host2 = new URIAuthority("somehost", 80); final URIAuthority host3 = new URIAuthority("someotherhost", 8080); final URIAuthority host4 = new URIAuthority("somehost", 80); final URIAuthority host5 = new URIAuthority("SomeHost", 80); final URIAuthority host6 = new URIAuthority("user", "SomeHost", 80); final URIAuthority host7 = new URIAuthority("user", "somehost", 80); Assert.assertTrue(host1.equals(host1)); Assert.assertFalse(host1.equals(host2)); Assert.assertFalse(host1.equals(host3)); Assert.assertTrue(host2.equals(host4)); Assert.assertTrue(host2.equals(host5)); Assert.assertFalse(host5.equals(host6)); Assert.assertTrue(host6.equals(host7)); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof URIAuthority) { final URIAuthority that = (URIAuthority) obj; return LangUtils.equals(this.userInfo, that.userInfo) && LangUtils.equals(this.hostname, that.hostname) && this.port == that.port; } return false; }
URIAuthority implements NamedEndpoint, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof URIAuthority) { final URIAuthority that = (URIAuthority) obj; return LangUtils.equals(this.userInfo, that.userInfo) && LangUtils.equals(this.hostname, that.hostname) && this.port == that.port; } return false; } }
URIAuthority implements NamedEndpoint, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof URIAuthority) { final URIAuthority that = (URIAuthority) obj; return LangUtils.equals(this.userInfo, that.userInfo) && LangUtils.equals(this.hostname, that.hostname) && this.port == that.port; } return false; } private  URIAuthority(final String userInfo, final String hostname, final int port, final boolean internal);  URIAuthority(final String userInfo, final String hostname, final int port);  URIAuthority(final String hostname, final int port);  URIAuthority(final NamedEndpoint namedEndpoint);  URIAuthority(final String hostname); }
URIAuthority implements NamedEndpoint, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof URIAuthority) { final URIAuthority that = (URIAuthority) obj; return LangUtils.equals(this.userInfo, that.userInfo) && LangUtils.equals(this.hostname, that.hostname) && this.port == that.port; } return false; } private  URIAuthority(final String userInfo, final String hostname, final int port, final boolean internal);  URIAuthority(final String userInfo, final String hostname, final int port);  URIAuthority(final String hostname, final int port);  URIAuthority(final NamedEndpoint namedEndpoint);  URIAuthority(final String hostname); static URIAuthority create(final String s); String getUserInfo(); @Override String getHostName(); @Override int getPort(); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode(); }
URIAuthority implements NamedEndpoint, Serializable { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj instanceof URIAuthority) { final URIAuthority that = (URIAuthority) obj; return LangUtils.equals(this.userInfo, that.userInfo) && LangUtils.equals(this.hostname, that.hostname) && this.port == that.port; } return false; } private  URIAuthority(final String userInfo, final String hostname, final int port, final boolean internal);  URIAuthority(final String userInfo, final String hostname, final int port);  URIAuthority(final String hostname, final int port);  URIAuthority(final NamedEndpoint namedEndpoint);  URIAuthority(final String hostname); static URIAuthority create(final String s); String getUserInfo(); @Override String getHostName(); @Override int getPort(); @Override String toString(); @Override boolean equals(final Object obj); @Override int hashCode();  }