UriEncoding { public static String encodePath(final String path) { requireNonNull(path); return encodeRFC3986UriComponent(path, ALLOWED_IN_PATH); }  static String encodePath(final String path); static String encodePathSegment(final String pathSegment); static String encodeQuery(final String query, final EncodingType encType); static String encodeQueryParam(final String queryParam, final EncodingType encType); static String decode(final String source, final EncodingType encType);  }
@Test public void specialCharsWithEncoding() { final String encodedChars = UriEncoding.encodePath(CHARS_SUPPORTED + CHARS_UNSUPPORTED_STRICT + CHARS_UNSUPPORTED_RELAXED); Uri.create("http: }
@Test public void encodePath() { assertEquals("foo", UriEncoding.encodePath("foo")); assertEquals("/top/sub", UriEncoding.encodePath("/top/sub")); assertEquals("!%22%23$%25&'()*+,/:;=%3F@%5B%5C%5D%7B%7C%7D%20%C3%A4aZ0", UriEncoding.encodePath(MANY_DIFFERENT_CHARS)); }