CustomEventInterstitialAdapter implements CustomEventInterstitialListener { @Override public void onInterstitialFailed(MoPubErrorCode errorCode) { if (isInvalidated()) { return; } if (mCustomEventInterstitialAdapterListener != null) { if (errorCode == null) { errorCode = UNSPECIFIED; } cancelTimeout(); mCustomEventInterstitialAdapterListener.onCustomEventInterstitialFailed(errorCode); } } CustomEventInterstitialAdapter(final MoPubInterstitial moPubInterstitial, final String className, final String jsonParams); @Override void onInterstitialLoaded(); @Override void onInterstitialFailed(MoPubErrorCode errorCode); @Override void onInterstitialShown(); @Override void onInterstitialClicked(); @Override void onLeaveApplication(); @Override void onInterstitialDismissed(); static final int DEFAULT_INTERSTITIAL_TIMEOUT_DELAY; }
@Test public void onInterstitialFailed_shouldLoadFailUrl() throws Exception { subject.onInterstitialFailed(ADAPTER_CONFIGURATION_ERROR); verify(interstitialAdapterListener).onCustomEventInterstitialFailed(eq(ADAPTER_CONFIGURATION_ERROR)); }
@Test public void onInterstitialFailed_whenErrorCodeIsNull_shouldPassUnspecifiedError() throws Exception { subject.onInterstitialFailed(null); verify(interstitialAdapterListener).onCustomEventInterstitialFailed(eq(UNSPECIFIED)); }