### Question:
Encoder { public static String path(CharSequence s) throws IllegalArgumentException { try { final URI uri = new URI("http", "0.0.0.0", "/" + s, null); return uri.toASCIIString().substring(15); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }  static String path(CharSequence s); static String query(CharSequence s);  }### Answer:
@Test public void testPath() { assertEquals("test", Encoder.path("test")); assertEquals("hello%20world", Encoder.path("hello world")); assertEquals("a%7Cb", Encoder.path("a|b")); assertEquals("%5Btest%5D", Encoder.path("[test]")); assertEquals("%22a%22", Encoder.path("\"a\"")); assertEquals("Really%3F", Encoder.path("Really?")); assertEquals("foo&bar", Encoder.path("foo&bar")); }