@Test public void onBannerCollapsed_shouldRestoreRefreshSettingAndCallAdClosed() throws Exception { stub(moPubView.getAutorefreshEnabled()).toReturn(true); subject.onBannerExpanded(); reset(moPubView); subject.onBannerCollapsed(); verify(moPubView).setAutorefreshEnabled(eq(true)); verify(moPubView).adClosed(); stub(moPubView.getAutorefreshEnabled()).toReturn(false); subject.onBannerExpanded(); reset(moPubView); subject.onBannerCollapsed(); verify(moPubView).setAutorefreshEnabled(eq(false)); verify(moPubView).adClosed(); }
@Test public void invalidate_shouldCauseBannerListenerMethodsToDoNothing() throws Exception { subject.invalidate(); subject.onBannerLoaded(null); subject.onBannerFailed(null); subject.onBannerExpanded(); subject.onBannerCollapsed(); subject.onBannerClicked(); subject.onLeaveApplication(); verify(moPubView, never()).nativeAdLoaded(); verify(moPubView, never()).setAdContentView(any(View.class)); verify(moPubView, never()).trackNativeImpression(); verify(moPubView, never()).loadFailUrl(any(MoPubErrorCode.class)); verify(moPubView, never()).setAutorefreshEnabled(any(boolean.class)); verify(moPubView, never()).adClosed(); verify(moPubView, never()).registerClick(); }