### Question:
URL { public static String filledURLWithNamedParams(String url, Object... keyValuePairs) { if ((keyValuePairs == null) || (keyValuePairs.length == 0)) { return url; } if (keyValuePairs.length % 2 != 0) { throw new IllegalArgumentException( "The array has to be of an even size - size is " + keyValuePairs.length); } final Map<String, Object> values = new HashMap<String, Object>(); for (int x = 0; x < keyValuePairs.length; x += 2) { values.put((String) keyValuePairs[x], keyValuePairs[x + 1]); } final UriComponents uricomponent = getUriComponent(url); return uricomponent.expand(values).encode().toUriString(); } private  URL(); static String filledURL(String url, Object parameter); static String filledURL(String url); static String filledURLWithNamedParams(String url,
            Object... keyValuePairs); static String filledURL(String url, Map<String, ?> parameters); static String redirect(String url, Object parameter); static String redirect(String url); static String redirectWithNamedParams(String url,
            Object... keyValuePairs); static String redirect(String url,
            Map<String, String> namedParameters); static final String HOME; }### Answer:
@Test public void testFilledURLStringStringArray() { final String templateString = "The {animal} jumped over the {target}."; final String result = URL.filledURLWithNamedParams(templateString, "animal", "quick brown fox", "target", "lazy dog"); assertThat(result) .isEqualTo( "The%20quick%20brown%20fox%20jumped%20over%20the%20lazy%20dog."); }
@Test public void testFilledURLStringStringArrayWithUnusualString() { final String templateString = "{animal} {target}."; final String result = URL.filledURLWithNamedParams(templateString, "animal", "quick brown fox", "target", "lazy dog"); assertThat(result).isEqualTo("quick%20brown%20fox%20lazy%20dog."); }