@Test public void buildOfValidUrlWithEmptyQueryParams() throws Exception { val hostName = "http: Map<String, String> queryParams = Collections.emptyMap(); assertEquals(new URL("http: }
public static URL buildURL(final String hostName, final Map<String, String> query) { val escapedQuery = query.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> UrlEscapers.urlFormParameterEscaper().escape(e.getValue()) )); try { return new URL( hostName + (!hostName.endsWith("?") ? "?" : "") + Joiner.on("&").withKeyValueSeparator("=").join(escapedQuery) ); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } }
HttpUtils { public static URL buildURL(final String hostName, final Map<String, String> query) { val escapedQuery = query.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> UrlEscapers.urlFormParameterEscaper().escape(e.getValue()) )); try { return new URL( hostName + (!hostName.endsWith("?") ? "?" : "") + Joiner.on("&").withKeyValueSeparator("=").join(escapedQuery) ); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } }
HttpUtils { public static URL buildURL(final String hostName, final Map<String, String> query) { val escapedQuery = query.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> UrlEscapers.urlFormParameterEscaper().escape(e.getValue()) )); try { return new URL( hostName + (!hostName.endsWith("?") ? "?" : "") + Joiner.on("&").withKeyValueSeparator("=").join(escapedQuery) ); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } private  HttpUtils(); }
HttpUtils { public static URL buildURL(final String hostName, final Map<String, String> query) { val escapedQuery = query.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> UrlEscapers.urlFormParameterEscaper().escape(e.getValue()) )); try { return new URL( hostName + (!hostName.endsWith("?") ? "?" : "") + Joiner.on("&").withKeyValueSeparator("=").join(escapedQuery) ); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } private  HttpUtils(); static boolean isReachable(final String hostName, int port, int timeout); static URL buildURL(final String hostName, final Map<String, String> query); }
HttpUtils { public static URL buildURL(final String hostName, final Map<String, String> query) { val escapedQuery = query.entrySet() .stream() .collect(Collectors.toMap( Map.Entry::getKey, e -> UrlEscapers.urlFormParameterEscaper().escape(e.getValue()) )); try { return new URL( hostName + (!hostName.endsWith("?") ? "?" : "") + Joiner.on("&").withKeyValueSeparator("=").join(escapedQuery) ); } catch (MalformedURLException e) { throw new IllegalArgumentException(e); } } private  HttpUtils(); static boolean isReachable(final String hostName, int port, int timeout); static URL buildURL(final String hostName, final Map<String, String> query);  }