@Test public void test_makeURLWithParam() { String urlString; try { Map<String, String> map = new HashMap<String, String>(); map.put("p1", "1"); map.put("p2", "2"); urlString = URLUtil.makeURLWithParam(url, map).toString(); } catch (RdapClientException e) { urlString = null; } assertTrue(urlWithParam.equals(urlString)||urlWithParam1.equals(urlString)); }
public static URL makeURLWithParam(String url, Map<String, String> param) throws RdapClientException { StringBuilder urlBuilder = new StringBuilder(url); if (param != null) { Set<String> keys = param.keySet(); if (keys.size() != 0) { StringBuilder paramBuilder = new StringBuilder(); for (String key : keys) { paramBuilder.append(key).append(ASSIGN) .append(param.get(key)).append(SPLIT); } urlBuilder.append(SEPARATE).append( paramBuilder.substring(0, paramBuilder.length() - 1)); } } try { return new URL(urlBuilder.toString()); } catch (MalformedURLException e) { throw new RdapClientException(e.getMessage()); } }
URLUtil { public static URL makeURLWithParam(String url, Map<String, String> param) throws RdapClientException { StringBuilder urlBuilder = new StringBuilder(url); if (param != null) { Set<String> keys = param.keySet(); if (keys.size() != 0) { StringBuilder paramBuilder = new StringBuilder(); for (String key : keys) { paramBuilder.append(key).append(ASSIGN) .append(param.get(key)).append(SPLIT); } urlBuilder.append(SEPARATE).append( paramBuilder.substring(0, paramBuilder.length() - 1)); } } try { return new URL(urlBuilder.toString()); } catch (MalformedURLException e) { throw new RdapClientException(e.getMessage()); } } }
URLUtil { public static URL makeURLWithParam(String url, Map<String, String> param) throws RdapClientException { StringBuilder urlBuilder = new StringBuilder(url); if (param != null) { Set<String> keys = param.keySet(); if (keys.size() != 0) { StringBuilder paramBuilder = new StringBuilder(); for (String key : keys) { paramBuilder.append(key).append(ASSIGN) .append(param.get(key)).append(SPLIT); } urlBuilder.append(SEPARATE).append( paramBuilder.substring(0, paramBuilder.length() - 1)); } } try { return new URL(urlBuilder.toString()); } catch (MalformedURLException e) { throw new RdapClientException(e.getMessage()); } } private  URLUtil(); }
URLUtil { public static URL makeURLWithParam(String url, Map<String, String> param) throws RdapClientException { StringBuilder urlBuilder = new StringBuilder(url); if (param != null) { Set<String> keys = param.keySet(); if (keys.size() != 0) { StringBuilder paramBuilder = new StringBuilder(); for (String key : keys) { paramBuilder.append(key).append(ASSIGN) .append(param.get(key)).append(SPLIT); } urlBuilder.append(SEPARATE).append( paramBuilder.substring(0, paramBuilder.length() - 1)); } } try { return new URL(urlBuilder.toString()); } catch (MalformedURLException e) { throw new RdapClientException(e.getMessage()); } } private  URLUtil(); static URL makeURL(String url); static URL makeURLWithPath(String url, String... path); static URL makeURLWithPath(String url, List<String> path); static URL makeURLWithParam(String url, Map<String, String> param); static URL makeURLWithPathAndParam(String url,
            Map<String, String> param, String... path); static URL makeURLWithPathAndParam(String url,
            Map<String, String> param, List<String> path); static boolean isHttps(URL url); }
URLUtil { public static URL makeURLWithParam(String url, Map<String, String> param) throws RdapClientException { StringBuilder urlBuilder = new StringBuilder(url); if (param != null) { Set<String> keys = param.keySet(); if (keys.size() != 0) { StringBuilder paramBuilder = new StringBuilder(); for (String key : keys) { paramBuilder.append(key).append(ASSIGN) .append(param.get(key)).append(SPLIT); } urlBuilder.append(SEPARATE).append( paramBuilder.substring(0, paramBuilder.length() - 1)); } } try { return new URL(urlBuilder.toString()); } catch (MalformedURLException e) { throw new RdapClientException(e.getMessage()); } } private  URLUtil(); static URL makeURL(String url); static URL makeURLWithPath(String url, String... path); static URL makeURLWithPath(String url, List<String> path); static URL makeURLWithParam(String url, Map<String, String> param); static URL makeURLWithPathAndParam(String url,
            Map<String, String> param, String... path); static URL makeURLWithPathAndParam(String url,
            Map<String, String> param, List<String> path); static boolean isHttps(URL url);  }