UriEncoding { public static String decode(final String source, final EncodingType encType) { requireNonNull(source); requireNonNull(encType); if (encType == EncodingType.FORM_URL_ENCODED) { return decodeFormUrlEncoded(source); } else { return decodeRFC3986(source); } }  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(expected = IllegalArgumentException.class) public void decodeRfc3986InvalidSequence() { UriEncoding.decode("foo%2", RFC3986); }
@Test(expected = IllegalArgumentException.class) public void decodeFormUrlEncodedInvalidSequence() { UriEncoding.decode("foo%2", RFC3986); }