URL { @Override public String toString() { StringBuilder url = new StringBuilder(); if (!StringUtil.isEmpty(this.protocol)) { url.append(this.protocol); url.append(": } if (!StringUtil.isEmpty(this.username)) { url.append(encode(this.username)); if (this.password != null) { url.append(':'); url.append(encode(this.password)); } url.append('@'); } if (!StringUtil.isEmpty(this.host)) { url.append(this.host); } if (this.port != null) { url.append(':'); url.append(this.port); } if (!StringUtil.isEmpty(this.path)) { url.append(this.path); } if (!StringUtil.isEmpty(this.query)) { url.append('?'); url.append(this.query); } return url.toString(); } URL(); @Override String toString(); void setProtocol(String protocol); String getProtocol(); void setUsername(String username); String getUsername(); void setPassword(String password); String getPassword(); void setHost(String host); String getHost(); void setPort(Integer port); Integer getPort(); void setPath(String path); String getPath(); String getQuery(); void setQuery(String value); String getQueryProperty(String name); Properties getQueryProperties(); static void parseQueryProperties(String q, Properties props); @Override boolean equals(Object object); @Override int hashCode();  }
@Test public void testToString() throws Exception { URL url = new URL(); url.setProtocol("p"); Assert.assertEquals("p: url.setHost("h"); Assert.assertEquals("p: url.setPort(80); Assert.assertEquals("p: url.setPath("/"); Assert.assertEquals("p: url.setUsername("u"); Assert.assertEquals("p: url.setPassword("p"); Assert.assertEquals("p: url.setPort(null); Assert.assertEquals("p: url.setUsername(null); Assert.assertEquals("p: url.setPath(null); Assert.assertEquals("p: }