use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class GamBannerEventHandler method handleAdFailure.
private void handleAdFailure(int errorCode) {
mRequestBanner = null;
recycleCurrentBanner();
switch(errorCode) {
case Constants.ERROR_CODE_INTERNAL_ERROR:
mBannerEventListener.onAdFailed(new AdException(AdException.THIRD_PARTY, "GAM SDK encountered an internal error."));
break;
case Constants.ERROR_CODE_INVALID_REQUEST:
mBannerEventListener.onAdFailed(new AdException(AdException.THIRD_PARTY, "GAM SDK - invalid request error."));
break;
case Constants.ERROR_CODE_NETWORK_ERROR:
mBannerEventListener.onAdFailed(new AdException(AdException.THIRD_PARTY, "GAM SDK - network error."));
break;
case Constants.ERROR_CODE_NO_FILL:
mBannerEventListener.onAdFailed(new AdException(AdException.THIRD_PARTY, "GAM SDK - no fill."));
break;
default:
mBannerEventListener.onAdFailed(new AdException(AdException.THIRD_PARTY, "GAM SDK - failed with errorCode: " + errorCode));
}
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class AdViewManagerTest method testAdViewManagerNullParams.
@Test
public void testAdViewManagerNullParams() {
InterstitialView mockAdView = mock(InterstitialView.class);
AdViewManager adViewManager = null;
AdException err = null;
try {
adViewManager = new AdViewManager(mContext, null, mockAdView, mMockInterstitialManager);
} catch (Exception e) {
err = new AdException(AdException.INTERNAL_ERROR, e.getMessage());
}
assertNotNull(err);
assertNull(adViewManager);
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class AdViewManagerTest method testAdViewManagerNullAdViewListener.
@Test
public void testAdViewManagerNullAdViewListener() {
InterstitialView mockAdView = mock(InterstitialView.class);
AdViewManager adViewManager = null;
AdException err = null;
try {
adViewManager = new AdViewManager(mContext, null, mockAdView, mMockInterstitialManager);
} catch (AdException e) {
err = e;
}
assertNotNull(err);
assertNull(adViewManager);
assertEquals(AdException.INTERNAL_ERROR + ": AdViewManagerListener is null", err.getMessage());
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class HTMLCreativeTest method webViewFailedToLoadTest.
@Test
public void webViewFailedToLoadTest() throws Exception {
CreativeResolutionListener mockResolutionListener = mock(CreativeResolutionListener.class);
mHtmlCreative.setResolutionListener(mockResolutionListener);
// Resolved
WhiteBox.field(HTMLCreative.class, "mResolved").set(mHtmlCreative, true);
mHtmlCreative.webViewFailedToLoad(new AdException("foo", "bar"));
verify(mockResolutionListener, never()).creativeFailed(any(AdException.class));
// Not resolved
WhiteBox.field(HTMLCreative.class, "mResolved").set(mHtmlCreative, false);
mHtmlCreative.webViewFailedToLoad(new AdException("foo", "bar"));
verify(mockResolutionListener).creativeFailed(any(AdException.class));
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class BannerViewTest method onFailedAndNoWinnerBid_AdRequestStatusIsFinishedNotifyErrorListener.
@Test
public void onFailedAndNoWinnerBid_AdRequestStatusIsFinishedNotifyErrorListener() {
changePrimaryAdServerRequestStatus(true);
mBannerView.setBidResponse(null);
final AdException exception = new AdException(AdException.INTERNAL_ERROR, "Test");
final BannerEventListener bannerEventListener = getBannerEventListener();
bannerEventListener.onAdFailed(exception);
verify(mMockBannerListener, times(1)).onAdFailed(mBannerView, exception);
}
Aggregations