AdAlertReporter { @Deprecated String getParameters() { return mParameters; } AdAlertReporter(final Context context, final View view, final AdConfiguration adConfiguration); void send();  }
@Test public void constructor_shouldProperlyConstructParametersTextFile() throws Exception { String expectedParameters = "sdk_version : 1.15.2.2\n" + "creative_id : \n" + "platform_version : 1\n" + "device_model : android\n" + "ad_unit_id : abc\n" + "device_locale : US\n" + "device_id : UDID\n" + "network_type : unknown\n" + "platform : android\n" + "timestamp : " + getCurrentDateTime() + "\n" + "ad_type : interstitial\n" + "ad_size : {480, 320}\n"; stub(adConfiguration.getSdkVersion()).toReturn("1.15.2.2"); stub(adConfiguration.getDspCreativeId()).toReturn(""); stub(adConfiguration.getPlatformVersion()).toReturn(1); stub(adConfiguration.getDeviceModel()).toReturn("android"); stub(adConfiguration.getAdUnitId()).toReturn("abc"); stub(adConfiguration.getDeviceLocale()).toReturn("US"); stub(adConfiguration.getHashedUdid()).toReturn("UDID"); stub(adConfiguration.getNetworkType()).toReturn("unknown"); stub(adConfiguration.getPlatform()).toReturn("android"); stub(adConfiguration.getTimeStamp()).toReturn(now.getTime()); stub(adConfiguration.getAdType()).toReturn("interstitial"); stub(adConfiguration.getWidth()).toReturn(480); stub(adConfiguration.getHeight()).toReturn(320); subject = new AdAlertReporter(context, view, adConfiguration); assertThat(subject.getParameters()).isEqualTo(expectedParameters); }
@Test public void constructor_withInvalidAdConfigurationValues_shouldReturnSomethingSensible() throws Exception { String expectedParameters = "sdk_version : null\n" + "creative_id : null\n" + "platform_version : -1\n" + "device_model : null\n" + "ad_unit_id : null\n" + "device_locale : null\n" + "device_id : null\n" + "network_type : null\n" + "platform : null\n" + "timestamp : null" + "\n" + "ad_type : null\n" + "ad_size : {-1, -1}\n"; stub(adConfiguration.getSdkVersion()).toReturn(null); stub(adConfiguration.getDspCreativeId()).toReturn(null); stub(adConfiguration.getPlatformVersion()).toReturn(-1); stub(adConfiguration.getDeviceModel()).toReturn(null); stub(adConfiguration.getAdUnitId()).toReturn(null); stub(adConfiguration.getDeviceLocale()).toReturn(null); stub(adConfiguration.getHashedUdid()).toReturn(null); stub(adConfiguration.getNetworkType()).toReturn(null); stub(adConfiguration.getPlatform()).toReturn(null); stub(adConfiguration.getTimeStamp()).toReturn(-1l); stub(adConfiguration.getAdType()).toReturn(null); stub(adConfiguration.getWidth()).toReturn(-1); stub(adConfiguration.getHeight()).toReturn(-1); subject = new AdAlertReporter(context, view, adConfiguration); assertThat(subject.getParameters()).isEqualTo(expectedParameters); }