DefaultUrl implements Url { @Override public String build() { Uri.Builder builder = Uri.parse(baseURL).buildUpon(); for (Map.Entry<String, String> entry : parameters.entrySet()) { builder.appendQueryParameter(entry.getKey(), entry.getValue()); } return builder.build().toString(); } DefaultUrl(@NonNull String baseUrl); @Override void fontScale(float fontScale); @Override void hardKeyboardHidden(int hardKeyboardHidden); @Override void keyboard(int keyboard); @Override void keyboardHidden(int keyboardHidden); @Override void locale(Locale locale); @Override void mcc(int mcc); @Override void mnc(int mnc); @Override void navigation(int navigation); @Override void navigationHidden(int navigationHidden); @Override void orientation(int orientation); @Override void screenLayout(int screenLayout); @Override void touchscreen(int touchscreen); @Override void uiMode(int uiMode); @Override void densityDpi(int densityDpi); @Override void screenWidthDp(int screenWidthDp); @Override void screenHeightDp(int screenHeightDp); @Override void smallestScreenWidthDp(int smallestScreenWidthDp); @Override String build();  }
@Test public void testBuild() throws Exception { url = new DefaultUrl(BASE_URL); url.screenHeightDp(7); url.densityDpi(5); String urlString = url.build(); assertThat("Contains density_dpi", urlString, containsString("density_dpi=5")); assertThat("Contains screen_height_dp", urlString, containsString("screen_height_dp=7")); }