Downloader { protected void buildUrl() { Configuration configuration = context.getResources().getConfiguration(); if (options.isUseFontScale()) { url.fontScale(configuration.fontScale); } if (options.isUseHardKeyboardHidden()) { url.hardKeyboardHidden(configuration.hardKeyboardHidden); } if (options.isUseKeyboard()) { url.keyboard(configuration.keyboard); } if (options.isUseKeyboardHidden()) { url.keyboardHidden(configuration.keyboardHidden); } if (options.isUseLocale()) { url.locale(configuration.locale); } if (options.isUseMcc()) { url.mcc(configuration.mcc); } if (options.isUseMnc()) { url.mnc(configuration.mnc); } if (options.isUseNavigation()) { url.navigation(configuration.navigation); } if (options.isUseNavigationHidden()) { url.navigationHidden(configuration.navigationHidden); } if (options.isUseOrientation()) { url.orientation(configuration.orientation); } if (options.isUseScreenLayout()) { url.screenLayout(configuration.screenLayout); } if (options.isUseTouchscreen()) { url.touchscreen(configuration.touchscreen); } if (options.isUseUiMode()) { url.uiMode(configuration.uiMode); } if (options.isUseDensityDpi() && SDK_INT >= JELLY_BEAN_MR1) { url.densityDpi(configuration.densityDpi); } if (SDK_INT >= HONEYCOMB_MR2) { if (options.isUseScreenWidthDp()) { url.screenWidthDp(configuration.screenWidthDp); } if (options.isUseScreenHeightDp()) { url.screenHeightDp(configuration.screenHeightDp); } if (options.isUseSmallestScreenWidthDp()) { url.smallestScreenWidthDp(configuration.smallestScreenWidthDp); } } } Downloader(@NonNull Context context, @NonNull Converter converter, @NonNull Url url,
      @NonNull Options options);  Downloader(@NonNull Context context, @NonNull OkHttpClient client,
      @NonNull Converter converter, @NonNull Url url, @NonNull Options options); Resources load(@Cache.Policy int policy);  }
@Config(sdk = LOLLIPOP) @Test public void testBuildUrlOnLollipop() throws Exception { setDefaultConfiguration(); DefaultUrl url = new DefaultUrl(BASE_URL); Downloader downloader = new Downloader(context, converter, url, options); downloader.buildUrl(); String urlString = url.build(); assertThat("Contains orientation", urlString, containsString("orientation=" + ORIENTATION)); assertThat("Contains keyboard", urlString, containsString("keyboard=" + KEYBOARD)); assertThat("Contains touch_screen", urlString, containsString("touch_screen=" + TOUCH_SCREEN)); assertThat("Contains font_scale", urlString, containsString("font_scale=" + FONT_SCALE)); assertThat("Contains mcc", urlString, containsString("mcc=" + MCC)); assertThat("Contains navigation_hidden", urlString, containsString("navigation_hidden=" + NAVIGATION_HIDDEN)); assertThat("Contains locale", urlString, containsString("locale=" + LOCALE)); assertThat("Contains smallest_screen_width_dp", urlString, containsString("smallest_screen_width_dp=" + SMALLEST_SCREEN_WIDTH_DP)); assertThat("Contains keyboard_hidden", urlString, containsString("keyboard_hidden=" + KEYBOARD_HIDDEN)); assertThat("Contains navigation", urlString, containsString("navigation=" + NAVIGATION)); assertThat("Contains screen_layout", urlString, containsString("screen_layout=" + SCREEN_LAYOUT)); assertThat("Contains screen_height_dp", urlString, containsString("screen_height_dp=" + SCREEN_HEIGHT_DP)); assertThat("Contains mnc", urlString, containsString("mnc=" + MNC)); assertThat("Contains ui_mode", urlString, containsString("ui_mode=" + UI_MODE)); assertThat("Contains hard_keyboard_hidden", urlString, containsString("hard_keyboard_hidden=" + HARD_KEYBOARD_HIDDEN)); assertThat("Contains density_dpi", urlString, containsString("density_dpi=" + DENSITY_DPI)); }
@Config(sdk = JELLY_BEAN) @Test public void testBuildUrlOnJellyBean() throws Exception { setDefaultConfiguration(); DefaultUrl url = new DefaultUrl(BASE_URL); Downloader downloader = new Downloader(context, converter, url, options); downloader.buildUrl(); String urlString = url.build(); assertThat("Contains orientation", urlString, containsString("orientation=" + ORIENTATION)); assertThat("Contains keyboard", urlString, containsString("keyboard=" + KEYBOARD)); assertThat("Contains touch_screen", urlString, containsString("touch_screen=" + TOUCH_SCREEN)); assertThat("Contains font_scale", urlString, containsString("font_scale=" + FONT_SCALE)); assertThat("Contains mcc", urlString, containsString("mcc=" + MCC)); assertThat("Contains navigation_hidden", urlString, containsString("navigation_hidden=" + NAVIGATION_HIDDEN)); assertThat("Contains locale", urlString, containsString("locale=" + LOCALE)); assertThat("Contains smallest_screen_width_dp", urlString, containsString("smallest_screen_width_dp=" + SMALLEST_SCREEN_WIDTH_DP)); assertThat("Contains keyboard_hidden", urlString, containsString("keyboard_hidden=" + KEYBOARD_HIDDEN)); assertThat("Contains navigation", urlString, containsString("navigation=" + NAVIGATION)); assertThat("Contains screen_layout", urlString, containsString("screen_layout=" + SCREEN_LAYOUT)); assertThat("Contains screen_height_dp", urlString, containsString("screen_height_dp=" + SCREEN_HEIGHT_DP)); assertThat("Contains mnc", urlString, containsString("mnc=" + MNC)); assertThat("Contains ui_mode", urlString, containsString("ui_mode=" + UI_MODE)); assertThat("Contains hard_keyboard_hidden", urlString, containsString("hard_keyboard_hidden=" + HARD_KEYBOARD_HIDDEN)); }