Search in sources :

Example 1 with RewardedVideoEventListener

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

the class RewardedAdUnitTest method onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd.

@Test
public void onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd() throws IllegalAccessException {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final InterstitialController mockInterstitialController = mock(InterstitialController.class);
    final Bid mockBid = mock(Bid.class);
    final RewardedVideoEventListener spyEventListener = spy(getEventListener());
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    WhiteBox.setInternalState(mRewardedAdUnit, "mBidResponse", mockBidResponse);
    WhiteBox.setInternalState(mRewardedAdUnit, "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) RewardedVideoEventListener(org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 2 with RewardedVideoEventListener

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

the class RewardedAdUnitTest method onAdOpened_NotifyClickListener.

@Test
public void onAdOpened_NotifyClickListener() {
    final RewardedVideoEventListener eventListener = getEventListener();
    eventListener.onAdClicked();
    verify(mMockRewardedAdUnitListener, times(1)).onAdClicked(mRewardedAdUnit);
}
Also used : RewardedVideoEventListener(org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener) Test(org.junit.Test)

Example 3 with RewardedVideoEventListener

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

the class RewardedAdUnitTest method onAdClosed_NotifyAdClosedListener.

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

Example 4 with RewardedVideoEventListener

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

the class RewardedAdUnitTest method onFailedAndNoWinnerBid_AdStatusReadyForLoadNotifyErrorListener.

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

Example 5 with RewardedVideoEventListener

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

the class RewardedAdUnitTest method onAdServerWin_AdStatusReadyToDisplayGAMNotifyAdLoaded.

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

Aggregations

Test (org.junit.Test)6 RewardedVideoEventListener (org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener)6 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