UriBuilder implements IBuilder<URI> { @NonNull public String buildString() { StringBuilder result = new StringBuilder(); result.append(scheme); result.append(": result.append(host); if (path != null) { appendArray(result.append('/'), path, '/'); } if (query != null) { appendMap(result.append('?'), query, '&', '='); } if (fragment != null) { appendMap(result.append('#'), fragment, '&', '='); } return result.toString(); } 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 testBuildString() { UriBuilder builder = new UriBuilder(scheme, host).path(path).query(query); assertEquals(rawScheme + ": }