### Question:
UrlEncoder { public static String encode(String s) { StringBuilder buffer = new StringBuilder(s.length() + 16); int start = -1; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || " .-*_".indexOf(ch) > -1) { if (start >= 0) { convert(s.substring(start, i), buffer); start = -1; } if (ch != ' ') buffer.append(ch); else buffer.append('+'); } else { if (start < 0) { start = i; } } } if (start >= 0) convert(s.substring(start, s.length()), buffer); return buffer.toString(); }  static String encode(String s); static String encode(TextualPath path);  }### Answer:
@Test public void testEncode() { assertEquals(".-_*", UrlEncoder.encode(".-_*")); assertEquals("%24%2B%21%27%28%29%2C", UrlEncoder.encode("$+!'(),")); assertEquals("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", UrlEncoder.encode("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")); assertEquals("x%C3%AB%C4%86%D2%B8abc%EF%AE%9A", UrlEncoder.encode("x\u00eb\u0106\u04b8abc\ufb9a")); assertEquals("abc%3Ddef%3Fsdf%26hil+sdlkfj+l+sdf+slkdfj+123%26def", UrlEncoder.encode("abc=def?sdf&hil sdlkfj l sdf slkdfj 123&def")); }