use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class BannerViewTest method onPrebidSdkWin_AdRequestStatusIsFinishedDisplayAdView.
@Test
public void onPrebidSdkWin_AdRequestStatusIsFinishedDisplayAdView() {
changePrimaryAdServerRequestStatus(true);
final BannerEventListener bannerEventListener = getBannerEventListener();
final BidResponse mockBidResponse = mock(BidResponse.class);
final Bid mockBid = mock(Bid.class);
when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
when(mockBidResponse.getWinningBidWidthHeightPairDips(any())).thenReturn(Pair.create(0, 0));
mBannerView.setBidResponse(mockBidResponse);
bannerEventListener.onPrebidSdkWin();
assertFalse(mBannerView.isPrimaryAdServerRequestInProgress());
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse 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());
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse 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());
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse 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);
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse 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);
}
Aggregations