UriEncoding { private static String decodeFormUrlEncoded(final String source) { try { return URLDecoder.decode(source, ENCODING); } catch (final UnsupportedEncodingException e) { throw new IllegalStateException(e); } }  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 decodeFormUrlEncoded() { assertEquals("", UriEncoding.decode("", FORM_URL_ENCODED)); assertEquals("foo", UriEncoding.decode("foo", FORM_URL_ENCODED)); assertEquals("with space", UriEncoding.decode("with%20space", FORM_URL_ENCODED)); assertEquals("with+PlusEncoded", UriEncoding.decode("with%2bPlusEncoded", FORM_URL_ENCODED)); assertEquals("with PlusNotEncoded", UriEncoding.decode("with+PlusNotEncoded", FORM_URL_ENCODED)); assertEquals(MANY_DIFFERENT_CHARS, UriEncoding.decode(MANY_DIFFERENT_CHARS_QUERY_PARAM_ENCODED_RFC3986, FORM_URL_ENCODED)); }