UriBuilder implements IBuilder<URI> { @NonNull public UriBuilder query(@Nullable SortedMap<String, String> query) { this.query = query; return this; } UriBuilder(@NonNull String scheme, @NonNull String host); @NonNull UriBuilder reset(); @NonNull UriBuilder path(@Nullable String... path); @NonNull UriBuilder query(@Nullable SortedMap<String, String> query); @NonNull UriBuilder fragment(@Nullable SortedMap<String, String> fragment); @NonNull String buildString(); @Override URI build(); @Nullable static String[] getPathArray(@NonNull URI uri); @Nullable static String[] getPathArray(@NonNull URI uri, int expectedSize); @Nullable static Map<String, String> getQueryMap(@NonNull URI uri); @Nullable static Map<String, String> getFragmentMap(@NonNull URI uri);  }
@Test public void testQuery() { URI uri = new UriBuilder(scheme, host).path(path).query(query).build(); assertEquals(rawQuery, uri.getRawQuery()); Map<String, String> tmp = UriBuilder.getQueryMap(uri); assertNotNull(tmp); assertEquals(query.size(), tmp.size()); for (Entry<String, String> o : tmp.entrySet()) { assertTrue(query.containsKey(o.getKey())); assertEquals(o.getValue(), query.get(o.getKey())); } }