HtmlInterstitial extends ResponseBodyInterstitial { @Override public void showInterstitial() { MoPubActivity.start(mContext, mHtmlData, mIsScrollable, mRedirectUrl, mClickthroughUrl, mAdConfiguration); }  @Override void showInterstitial();  }
@Test public void showInterstitial_withMinimumExtras_shouldStartMoPubActivityWithDefaults() throws Exception { subject.loadInterstitial(context, customEventInterstitialListener, localExtras, serverExtras); subject.showInterstitial(); Intent nextStartedActivity = Robolectric.getShadowApplication().getNextStartedActivity(); assertThat(nextStartedActivity.getStringExtra(HTML_RESPONSE_BODY_KEY)).isEqualTo(expectedResponse); assertThat(nextStartedActivity.getBooleanExtra(SCROLLABLE_KEY, false)).isFalse(); assertThat(nextStartedActivity.getStringExtra(REDIRECT_URL_KEY)).isNull(); assertThat(nextStartedActivity.getStringExtra(CLICKTHROUGH_URL_KEY)).isNull(); assertThat(nextStartedActivity.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK).isNotEqualTo(0); assertThat(nextStartedActivity.getComponent().getClassName()).isEqualTo("com.mopub.mobileads.MoPubActivity"); }
@Test public void showInterstitial_shouldStartMoPubActivityWithAllExtras() throws Exception { serverExtras.put(SCROLLABLE_KEY, "true"); serverExtras.put(REDIRECT_URL_KEY, "redirectUrl"); serverExtras.put(CLICKTHROUGH_URL_KEY, "clickthroughUrl"); subject.loadInterstitial(context, customEventInterstitialListener, localExtras, serverExtras); subject.showInterstitial(); Intent nextStartedActivity = Robolectric.getShadowApplication().getNextStartedActivity(); assertThat(nextStartedActivity.getStringExtra(HTML_RESPONSE_BODY_KEY)).isEqualTo(expectedResponse); assertThat(nextStartedActivity.getBooleanExtra(SCROLLABLE_KEY, false)).isTrue(); assertThat(nextStartedActivity.getStringExtra(REDIRECT_URL_KEY)).isEqualTo("redirectUrl"); assertThat(nextStartedActivity.getStringExtra(CLICKTHROUGH_URL_KEY)).isEqualTo("clickthroughUrl"); assertThat(nextStartedActivity.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK).isNotEqualTo(0); assertThat(nextStartedActivity.getComponent().getClassName()).isEqualTo("com.mopub.mobileads.MoPubActivity"); }