Search in sources :

Example 41 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method onFailedAndNoWinnerBid_AdStatusReadyForLoadNotifyErrorListener.

@Test
public void onFailedAndNoWinnerBid_AdStatusReadyForLoadNotifyErrorListener() {
    final AdException exception = new AdException(AdException.INTERNAL_ERROR, "Test");
    final InterstitialEventListener eventListener = getEventListener();
    eventListener.onAdFailed(exception);
    verify(mMockInterstitialAdUnitListener, times(1)).onAdFailed(mInterstitialAdUnit, exception);
    assertEquals(READY_FOR_LOAD, mInterstitialAdUnit.getAdUnitState());
}
Also used : InterstitialEventListener(org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 42 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd.

@Test
public void onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd() {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final InterstitialController mockInterstitialController = mock(InterstitialController.class);
    final Bid mockBid = mock(Bid.class);
    final InterstitialEventListener spyEventListener = spy(getEventListener());
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mBidResponse", mockBidResponse);
    WhiteBox.setInternalState(mInterstitialAdUnit, "mInterstitialController", mockInterstitialController);
    spyEventListener.onAdFailed(new AdException(AdException.INTERNAL_ERROR, "Test"));
    verify(spyEventListener, times(1)).onPrebidSdkWin();
    verify(mockInterstitialController, times(1)).loadAd(any(), any());
}
Also used : InterstitialController(org.prebid.mobile.rendering.bidding.display.InterstitialController) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) InterstitialEventListener(org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 43 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class VideoViewTest method failedToLoad_NotifyListener.

@Test
public void failedToLoad_NotifyListener() {
    final AdException expectedException = new AdException(AdException.INTERNAL_ERROR, "message");
    mAdViewManagerListener.failedToLoad(expectedException);
    verify(mMockVideoViewListener).onLoadFailed(mVideoView, expectedException);
}
Also used : AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 44 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class VideoViewTest method notifyErrorListeners_InvokeOnLoadFailed.

@Test
public void notifyErrorListeners_InvokeOnLoadFailed() {
    AdException adException = new AdException(AdException.INTERNAL_ERROR, AdException.INIT_ERROR);
    mVideoView.notifyErrorListeners(adException);
    verify(mMockVideoViewListener).onLoadFailed(mVideoView, adException);
}
Also used : AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 45 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class BaseInterstitialAdUnitTest method loadAdWithError_BidResponseIsNull.

@Test
public void loadAdWithError_BidResponseIsNull() {
    BidResponse bidResponse = mBaseInterstitialAdUnit.getBidResponse();
    assertNull(bidResponse);
    final AdException adException = mock(AdException.class);
    BidRequesterListener listener = getBidRequesterListener();
    listener.onError(adException);
    mBaseInterstitialAdUnit.loadAd();
    bidResponse = mBaseInterstitialAdUnit.getBidResponse();
    assertNull(bidResponse);
}
Also used : BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) BidRequesterListener(org.prebid.mobile.rendering.bidding.listeners.BidRequesterListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Aggregations

AdException (org.prebid.mobile.rendering.errors.AdException)54 Test (org.junit.Test)25 InterstitialController (org.prebid.mobile.rendering.bidding.display.InterstitialController)7 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)6 AdError (com.google.android.gms.ads.AdError)5 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)5 Bid (org.prebid.mobile.rendering.bidding.data.bid.Bid)4 InterstitialControllerListener (org.prebid.mobile.rendering.bidding.interfaces.InterstitialControllerListener)4 CreativeModel (org.prebid.mobile.rendering.models.CreativeModel)4 InterstitialManager (org.prebid.mobile.rendering.views.interstitial.InterstitialManager)4 Context (android.content.Context)2 Bundle (android.os.Bundle)2 NonNull (androidx.annotation.NonNull)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)2 BannerEventListener (org.prebid.mobile.rendering.bidding.listeners.BannerEventListener)2 InterstitialEventListener (org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener)2 RewardedVideoEventListener (org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener)2 VastExtractorResult (org.prebid.mobile.rendering.models.internal.VastExtractorResult)2