Search in sources :

Example 1 with InterstitialEventListener

use of org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method onAdClosed_NotifyAdClosedListener.

@Test
public void onAdClosed_NotifyAdClosedListener() {
    final InterstitialEventListener eventListener = getEventListener();
    eventListener.onAdClosed();
    verify(mMockInterstitialAdUnitListener, times(1)).onAdClosed(mInterstitialAdUnit);
}
Also used : InterstitialEventListener(org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener) Test(org.junit.Test)

Example 2 with InterstitialEventListener

use of org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener 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 3 with InterstitialEventListener

use of org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener 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 4 with InterstitialEventListener

use of org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method onPrebidSdkWinAndWinnerBidIsNull_AdStatusReadyForLoadNotifyErrorListener.

// endregion ======================= BidRequestListener tests
// region ================= EventListener tests
@Test
public void onPrebidSdkWinAndWinnerBidIsNull_AdStatusReadyForLoadNotifyErrorListener() {
    final InterstitialEventListener eventListener = getEventListener();
    eventListener.onPrebidSdkWin();
    verify(mMockInterstitialAdUnitListener, times(1)).onAdFailed(eq(mInterstitialAdUnit), any(AdException.class));
    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 5 with InterstitialEventListener

use of org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener in project prebid-mobile-android by prebid.

the class InterstitialAdUnitTest method onAdServerWin_AdStatusReadyToDisplayGAMNotifyAdLoaded.

@Test
public void onAdServerWin_AdStatusReadyToDisplayGAMNotifyAdLoaded() {
    final InterstitialEventListener eventListener = getEventListener();
    eventListener.onAdServerWin();
    assertEquals(BaseInterstitialAdUnit.InterstitialAdUnitState.READY_TO_DISPLAY_GAM, mInterstitialAdUnit.getAdUnitState());
    verify(mMockInterstitialAdUnitListener, times(1)).onAdLoaded(mInterstitialAdUnit);
}
Also used : InterstitialEventListener(org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)5 InterstitialEventListener (org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener)5 AdException (org.prebid.mobile.rendering.errors.AdException)3 Bid (org.prebid.mobile.rendering.bidding.data.bid.Bid)1 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)1 InterstitialController (org.prebid.mobile.rendering.bidding.display.InterstitialController)1