### Question:
UrlBuilder { public void addQuery(String query) { if (!StringUtils.isBlank(query)) { getQueryParameters().putAll(getQueryParameters(query)); myQuery = null; } } UrlBuilder();  UrlBuilder(String url);  UrlBuilder(URL url); void addPath(String path); void addQuery(String query); String getHost(); String getPath(); int getPort(); String getProtocol(); String getQuery(); Map<String, String> getQueryParameters(); String getRef(); void setHost(String host); void setPath(String path); void setPort(int port); void setProtocol(String protocol); void setQuery(String query); void setQueryParameters(Map<String, String> queryParameters); void setRef(String ref); void setUrl(URL url); @Override String toString(); URL toURL();  }### Answer:
@Test public void testAddQuery() { URL input = createUrl("http: URL expected = createUrl("http: UrlBuilder builder = new UrlBuilder(input); builder.addQuery("e=f"); try { Assert.assertEquals(expected.toString(), builder.toURL().toString()); } catch (MalformedURLException e) { Assert.fail(e.getMessage()); } }