Search in sources :

Example 1 with BidRequesterListener

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

the class RewardedAdUnitTest method onFetchComplete_ChangeInterstitialStateToLoadingAndRequestAdWithBid.

// region ======================= BidRequestListener tests
@Test
public void onFetchComplete_ChangeInterstitialStateToLoadingAndRequestAdWithBid() {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    BidRequesterListener listener = getBidRequesterListener();
    listener.onFetchCompleted(mockBidResponse);
    verify(mMockRewardedEventHandler, times(1)).requestAdWithBid(eq(mockBid));
    assertEquals(LOADING, mRewardedAdUnit.getAdUnitState());
}
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 2 with BidRequesterListener

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

the class InterstitialAdUnitTest method onError_RequestAdWitNullBid.

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

Example 3 with BidRequesterListener

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

the class InterstitialAdUnitTest method onFetchComplete_ChangeInterstitialStateToLoadingAndRequestAdWithBid.

// region ======================= BidRequestListener tests
@Test
public void onFetchComplete_ChangeInterstitialStateToLoadingAndRequestAdWithBid() {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    BidRequesterListener listener = getBidRequesterListener();
    listener.onFetchCompleted(mockBidResponse);
    verify(mMockInterstitialEventHandler, times(1)).requestAdWithBid(eq(mockBid));
    assertEquals(LOADING, mInterstitialAdUnit.getAdUnitState());
}
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 4 with BidRequesterListener

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

the class BannerViewTest method onError_NullifyWinnerBidAndRequestAdWitNullBid.

@Test
public void onError_NullifyWinnerBidAndRequestAdWitNullBid() {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    mBannerView.setBidResponse(mockBidResponse);
    BidRequesterListener listener = getBidRequesterListener();
    listener.onError(any());
    assertNull(mBannerView.getWinnerBid());
    assertNull(mBannerView.getBidResponse());
    verify(mMockEventHandler, times(1)).requestAdWithBid(eq(null));
}
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 5 with BidRequesterListener

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

the class BannerViewTest method onFetchComplete_AssignWinningBidMarkPrimaryServerRequestInProgressRequestAdWithBid.

// region ======================= BidRequestListener tests
@Test
public void onFetchComplete_AssignWinningBidMarkPrimaryServerRequestInProgressRequestAdWithBid() {
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    BidRequesterListener listener = getBidRequesterListener();
    listener.onFetchCompleted(mockBidResponse);
    Bid winningBid = mBannerView.getWinnerBid();
    BidResponse actualResponse = mBannerView.getBidResponse();
    assertEquals(winningBid, mockBid);
    assertEquals(mockBidResponse, actualResponse);
    verify(mMockEventHandler, times(1)).requestAdWithBid(eq(mockBid));
    assertTrue(mBannerView.isPrimaryAdServerRequestInProgress());
}
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)

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