Search in sources :

Example 6 with BidRequesterListener

use of org.prebid.mobile.rendering.bidding.listeners.BidRequesterListener 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)

Example 7 with BidRequesterListener

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

the class BaseInterstitialAdUnitTest method loadAd_BidResponseIsInitialized.

@Test
public void loadAd_BidResponseIsInitialized() {
    BidResponse bidResponse = mBaseInterstitialAdUnit.getBidResponse();
    assertNull(bidResponse);
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    BidRequesterListener listener = getBidRequesterListener();
    listener.onFetchCompleted(mockBidResponse);
    mBaseInterstitialAdUnit.loadAd();
    BidResponse actualBidResponse = mBaseInterstitialAdUnit.getBidResponse();
    assertEquals(mockBidResponse, actualBidResponse);
}
Also used : BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) BidRequesterListener(org.prebid.mobile.rendering.bidding.listeners.BidRequesterListener) Test(org.junit.Test)

Example 8 with BidRequesterListener

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

the class RewardedAdUnitTest method onError_RequestAdWitNullBid.

@Test
public void onError_RequestAdWitNullBid() {
    BidRequesterListener listener = getBidRequesterListener();
    listener.onError(any());
    verify(mMockRewardedEventHandler, times(1)).requestAdWithBid(eq(null));
}
Also used : BidRequesterListener(org.prebid.mobile.rendering.bidding.listeners.BidRequesterListener) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 BidRequesterListener (org.prebid.mobile.rendering.bidding.listeners.BidRequesterListener)8 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)6 Bid (org.prebid.mobile.rendering.bidding.data.bid.Bid)5 AdException (org.prebid.mobile.rendering.errors.AdException)1