HttpUtil { public static MultivaluedMap<String, String> parseQueryParams( final URI uri) { if (uri == null) { return new MultivaluedStringMap(); } return parseQueryParams(uri.getRawQuery()); } private  HttpUtil(); static String authHeaderBasic(final String login,
                                         final String password); static String authHeaderBasic(final BigInteger login,
                                         final String password); static String authHeaderBearer(final BigInteger token); static String authHeaderBearer(final String token); static MultivaluedMap<String, String> parseQueryParams(
            final URI uri); static MultivaluedMap<String, String> parseQueryParams(
            final String query); static MultivaluedMap<String, String> parseBodyParams(
            final Response response);  }
@Test public void parseQueryParamsFromUri() throws Exception { URI singleParams = new URIBuilder("http: .build(); MultivaluedMap<String, String> params = HttpUtil.parseQueryParams(singleParams); assertEquals(2, params.size()); assertEquals("cat", params.getFirst("lol")); assertEquals("bar", params.getFirst("foo")); MultivaluedMap<String, String> params2 = HttpUtil.parseQueryParams((URI) null); assertEquals(0, params2.size()); }
@Test public void parseBodyParamsFromRawString() { MultivaluedMap<String, String> params = HttpUtil.parseQueryParams("foo=bar&lol=cat"); assertEquals(2, params.size()); assertEquals("cat", params.getFirst("lol")); assertEquals("bar", params.getFirst("foo")); MultivaluedMap<String, String> params2 = HttpUtil.parseQueryParams(""); assertEquals(0, params2.size()); MultivaluedMap<String, String> params3 = HttpUtil.parseQueryParams((String) null); assertEquals(0, params3.size()); MultivaluedMap<String, String> params4 = HttpUtil.parseQueryParams("noValue"); assertEquals(1, params4.size()); assertNull(params.getFirst("noValue")); MultivaluedMap<String, String> params5 = HttpUtil.parseQueryParams("foo=bar&foo=baz"); assertEquals(1, params5.size()); assertEquals(2, params5.get("foo").size()); assertTrue(params5.get("foo").contains("bar")); assertTrue(params5.get("foo").contains("baz")); }