URIAuthority implements NamedEndpoint, Serializable { @Override public String toString() { return format(this); } 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 testToString() throws Exception { final URIAuthority host1 = new URIAuthority("somehost"); Assert.assertEquals("somehost", host1.toString()); final URIAuthority host2 = new URIAuthority("somehost", -1); Assert.assertEquals("somehost", host2.toString()); final URIAuthority host3 = new URIAuthority("somehost", 8888); Assert.assertEquals("somehost:8888", host3.toString()); }