@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());
}