URIAuthority implements NamedEndpoint, Serializable { @Override public int hashCode() { int hash = LangUtils.HASH_SEED; hash = LangUtils.hashCode(hash, userInfo); hash = LangUtils.hashCode(hash, hostname); hash = LangUtils.hashCode(hash, port); return hash; } 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();  }
@Test public void testHashCode() 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.hashCode() == host1.hashCode()); Assert.assertTrue(host1.hashCode() != host2.hashCode()); Assert.assertTrue(host1.hashCode() != host3.hashCode()); Assert.assertTrue(host2.hashCode() == host4.hashCode()); Assert.assertTrue(host2.hashCode() == host5.hashCode()); Assert.assertTrue(host5.hashCode() != host6.hashCode()); Assert.assertTrue(host6.hashCode() == host7.hashCode()); }