@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(); }
@Before public void setUp() throws Exception { activity = Robolectric.buildActivity(Activity.class).create().get(); subject = new MoPubInterstitial(activity, AD_UNIT_ID_VALUE); interstitialAdListener = mock(MoPubInterstitial.InterstitialAdListener.class); subject.setInterstitialAdListener(interstitialAdListener); interstitialView = mock(MoPubInterstitial.MoPubInterstitialView.class); customEventClassName = "class name"; serverExtras = new HashMap<String, String>(); serverExtras.put("testExtra", "class data"); customEventInterstitialAdapter = TestCustomEventInterstitialAdapterFactory.getSingletonMock(); reset(customEventInterstitialAdapter); adViewController = TestAdViewControllerFactory.getSingletonMock(); }