### Question:
UrlUtil { public static String encode(String uri) { return encode(uri, Opslab.UTF_8); }  static String encodeScheme(String scheme, String encoding); static String encodeScheme(String scheme); static String encodeUserInfo(String userInfo, String encoding); static String encodeUserInfo(String userInfo); static String encodeHost(String host, String encoding); static String encodeHost(String host); static String encodePort(String port, String encoding); static String encodePort(String port); static String encodePath(String path, String encoding); static String encodePath(String path); static String encodePathSegment(String segment, String encoding); static String encodePathSegment(String segment); static String encodeQuery(String query, String encoding); static String encodeQuery(String query); static String encodeQueryParam(String queryParam, String encoding); static String encodeQueryParam(String queryParam); static String encodeFragment(String fragment, String encoding); static String encodeFragment(String fragment); static String encode(String uri); static String encode(String uri, String encoding); static String encodeHttpUrl(String httpUrl); static String encodeHttpUrl(String httpUrl, String encoding); static Builder build(String path); static Builder build(String path, boolean encodePath); static String decode(String url); static String decode(String source, String encoding); static String decodeQuery(String source); static String decodeQuery(String source, String encoding); final static String setParam(String url, String paramName, String paramValue); static final String getParamValue(String url, String paramName); static final String removeParam(String url, String... paramNames); static final String removeParam(String url, String paramName); static String urlJoin(URL url, String locationHeader); static Map print(HttpServletRequest request); static Map<String, String> parseQuery(String query, char split1, char split2, String dupLink); static Map<String, String> httpParseQuery(String queryUri);  }### Answer:
@Test public void testEncode() { assertEquals("/aaa", UrlUtil.encode("/aaa")); assertEquals("/aaa?", UrlUtil.encode("/aaa?")); assertEquals("/aaa?b", UrlUtil.encode("/aaa?b")); assertEquals("/aaa?b=", UrlUtil.encode("/aaa?b=")); assertEquals("/aaa?b=c", UrlUtil.encode("/aaa?b=c")); assertEquals("/aaa?b=%20c", UrlUtil.encode("/aaa?b= c")); assertEquals("/aaa?b=%20c&", UrlUtil.encode("/aaa?b= c&")); assertEquals("/aaa?b=%20c&dd", UrlUtil.encode("/aaa?b= c&dd")); assertEquals("/aaa?b=%20c&dd=", UrlUtil.encode("/aaa?b= c&dd=")); assertEquals("/aaa?b=%20%20c&dd==", UrlUtil.encode("/aaa?b= c&dd==")); assertEquals("?data=The%20string%20%C3%BC@foo-bar", UrlUtil.encode("?data=The string ü@foo-bar")); }