@Test public void generateAdUrl_shouldIncludeAllFields() throws Exception { final String expectedAdUrl = new AdUrlBuilder(expectedUdid) .withAdUnitId("adUnitId") .withQuery("key%3Avalue") .withLatLon("20.1%2C30.0", "1", "101325") .withMcc("123") .withMnc("456") .withCountryIso("expected%20country") .withCarrierName("expected%20carrier") .withExternalStoragePermission(false) .build(); shadowTelephonyManager.setNetworkOperator("123456"); shadowTelephonyManager.setNetworkCountryIso("expected country"); shadowTelephonyManager.setNetworkOperatorName("expected carrier"); Location location = new Location(""); location.setLatitude(20.1); location.setLongitude(30.0); location.setAccuracy(1.23f); location.setTime(System.currentTimeMillis() - 101325); String adUrl = subject .withAdUnitId("adUnitId") .withKeywords("key:value") .withLocation(location) .generateUrlString("ads.mopub.com"); adUrl = adUrl.replaceFirst("llf=101[0-9]{3}", "llf=101325"); assertThat(adUrl).isEqualTo(expectedAdUrl); }
@Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } WebViewAdUrlGenerator(Context context, boolean isStorePictureSupported); }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } WebViewAdUrlGenerator(Context context, boolean isStorePictureSupported); @Override String generateUrlString(String serverHostname); }
WebViewAdUrlGenerator extends AdUrlGenerator { @Override public String generateUrlString(String serverHostname) { initUrlString(serverHostname, Constants.AD_HANDLER); setApiVersion("6"); final ClientMetadata clientMetadata = ClientMetadata.getInstance(mContext); addBaseParams(clientMetadata); setMraidFlag(true); setExternalStoragePermission(mIsStorePictureSupported); return getFinalUrlString(); } WebViewAdUrlGenerator(Context context, boolean isStorePictureSupported); @Override String generateUrlString(String serverHostname);  }