QueryStringDecoderUtil { public String uri() { return uri; } QueryStringDecoderUtil(String uri);  QueryStringDecoderUtil(String uri, boolean hasPath);  QueryStringDecoderUtil(String uri, Charset charset);  QueryStringDecoderUtil(String uri, Charset charset, boolean hasPath);  QueryStringDecoderUtil(String uri, Charset charset, boolean hasPath, int maxParams);  QueryStringDecoderUtil(URI uri);  QueryStringDecoderUtil(URI uri, Charset charset);  QueryStringDecoderUtil(URI uri, Charset charset, int maxParams); String uri(); String path(); Map<String, List<String>> parameters(); static String decodeComponent(final String s); static String decodeComponent(final String s, final Charset charset);  }
@Test public void testURI() { URI uri = URI.create("http: QueryStringDecoderUtil decoder = new QueryStringDecoderUtil(uri); assertEquals("/foo", decoder.path()); Map<String, List<String>> params = decoder.parameters(); assertEquals(3, params.size()); Iterator<Entry<String, List<String>>> entries = params.entrySet().iterator(); Entry<String, List<String>> entry = entries.next(); assertEquals("param1", entry.getKey()); assertEquals(1, entry.getValue().size()); assertEquals("value1", entry.getValue().get(0)); entry = entries.next(); assertEquals("param2", entry.getKey()); assertEquals(1, entry.getValue().size()); assertEquals("value2", entry.getValue().get(0)); entry = entries.next(); assertEquals("param3", entry.getKey()); assertEquals(1, entry.getValue().size()); assertEquals("value3", entry.getValue().get(0)); assertFalse(entries.hasNext()); }