@Test public void loadCustomEvent_shouldCreateAndLoadCustomEventInterstitialAdapter() throws Exception { MoPubInterstitial.MoPubInterstitialView moPubInterstitialView = subject.new MoPubInterstitialView(activity); moPubInterstitialView.loadCustomEvent(customEventClassName, serverExtras); assertThat(TestCustomEventInterstitialAdapterFactory.getLatestMoPubInterstitial()) .isSameAs(subject); assertThat(TestCustomEventInterstitialAdapterFactory.getLatestClassName()) .isEqualTo("class name"); assertThat(TestCustomEventInterstitialAdapterFactory.getLatestServerExtras().get("testExtra")) .isEqualTo("class data"); }
@Test public void loadCustomEvent_shouldInitializeCustomEventInterstitialAdapter() throws Exception { MoPubInterstitial.MoPubInterstitialView moPubInterstitialView = subject.new MoPubInterstitialView(activity); serverExtras.put("testExtra", "data"); moPubInterstitialView.loadCustomEvent("name", serverExtras); assertThat(TestCustomEventInterstitialAdapterFactory.getLatestMoPubInterstitial()) .isEqualTo(subject); assertThat(TestCustomEventInterstitialAdapterFactory.getLatestClassName()).isEqualTo("name"); assertThat(TestCustomEventInterstitialAdapterFactory.getLatestServerExtras().get("testExtra")) .isEqualTo("data"); verify(customEventInterstitialAdapter).setAdapterListener(eq(subject)); verify(customEventInterstitialAdapter).loadInterstitial(); }