@Test public void buildUrlsWithCorrectlyEncodedParameters() { Parameters parameters = new Parameters(); parameters.set("a", "what?"); parameters.set("b", "F=ma"); parameters.set("c", "hello world"); parameters.set("d", "1+2"); assertThat(buildUrlWithParameters("http: is("http: }
public static String buildUrlWithParameters(final String url, final Parameters parameters) { checkNotNull(url); checkNotNull(parameters); try { URIBuilder builder = new URIBuilder(url); for (Entry<String, String> parameter : parameters.entries()) { builder.addParameter(parameter.getKey(), parameter.getValue()); } URI uri = builder.build(); return uri.toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Unable to build url with base url " + url + " and parameters " + parameters, e); } }
ViewUtils { public static String buildUrlWithParameters(final String url, final Parameters parameters) { checkNotNull(url); checkNotNull(parameters); try { URIBuilder builder = new URIBuilder(url); for (Entry<String, String> parameter : parameters.entries()) { builder.addParameter(parameter.getKey(), parameter.getValue()); } URI uri = builder.build(); return uri.toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Unable to build url with base url " + url + " and parameters " + parameters, e); } } }
ViewUtils { public static String buildUrlWithParameters(final String url, final Parameters parameters) { checkNotNull(url); checkNotNull(parameters); try { URIBuilder builder = new URIBuilder(url); for (Entry<String, String> parameter : parameters.entries()) { builder.addParameter(parameter.getKey(), parameter.getValue()); } URI uri = builder.build(); return uri.toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Unable to build url with base url " + url + " and parameters " + parameters, e); } } private  ViewUtils(); }
ViewUtils { public static String buildUrlWithParameters(final String url, final Parameters parameters) { checkNotNull(url); checkNotNull(parameters); try { URIBuilder builder = new URIBuilder(url); for (Entry<String, String> parameter : parameters.entries()) { builder.addParameter(parameter.getKey(), parameter.getValue()); } URI uri = builder.build(); return uri.toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Unable to build url with base url " + url + " and parameters " + parameters, e); } } private  ViewUtils(); static String buildUrlWithParameters(final String url, final Parameters parameters); static void copyLocalContextAttributes(final Context existingContext, final Context newContext); }
ViewUtils { public static String buildUrlWithParameters(final String url, final Parameters parameters) { checkNotNull(url); checkNotNull(parameters); try { URIBuilder builder = new URIBuilder(url); for (Entry<String, String> parameter : parameters.entries()) { builder.addParameter(parameter.getKey(), parameter.getValue()); } URI uri = builder.build(); return uri.toString(); } catch (URISyntaxException e) { throw new IllegalArgumentException("Unable to build url with base url " + url + " and parameters " + parameters, e); } } private  ViewUtils(); static String buildUrlWithParameters(final String url, final Parameters parameters); static void copyLocalContextAttributes(final Context existingContext, final Context newContext);  }