use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class BannerViewTest method onFailedAndWithWinnerBid_AdRequestStatusIsFinishedNotifyPrebidSdkWin.
@Test
public void onFailedAndWithWinnerBid_AdRequestStatusIsFinishedNotifyPrebidSdkWin() {
changePrimaryAdServerRequestStatus(true);
final BidResponse mockBidResponse = mock(BidResponse.class);
final Bid mockBid = mock(Bid.class);
final BannerEventListener spyEventListener = spy(getBannerEventListener());
when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
when(mockBidResponse.getWinningBidWidthHeightPairDips(any())).thenReturn(Pair.create(0, 0));
mBannerView.setBidResponse(mockBidResponse);
spyEventListener.onAdFailed(new AdException(AdException.INTERNAL_ERROR, "Test"));
assertFalse(mBannerView.isPrimaryAdServerRequestInProgress());
verify(spyEventListener, times(1)).onPrebidSdkWin();
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid 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());
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class GamInterstitialEventHandlerTest method requestAdWithDifferentBids_VerifyAdStatus.
@Test
public void requestAdWithDifferentBids_VerifyAdStatus() {
final Bid mockBid = mock(Bid.class);
final Prebid mockPrebid = mock(Prebid.class);
when(mockPrebid.getTargeting()).thenReturn(new HashMap<>());
when(mockBid.getPrebid()).thenReturn(mockPrebid);
when(mockBid.getPrice()).thenReturn(0.2);
mEventHandler.requestAdWithBid(mockBid);
assertTrue(getExpectingAppEventStatus());
when(mockBid.getPrice()).thenReturn(0.0);
mEventHandler.requestAdWithBid(mockBid);
assertFalse(getExpectingAppEventStatus());
mEventHandler.requestAdWithBid(null);
assertFalse(getExpectingAppEventStatus());
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class GamRewardedEventHandlerTest method requestAdWithDifferentBids_VerifyAdStatus.
@Test
public void requestAdWithDifferentBids_VerifyAdStatus() {
final Bid mockBid = mock(Bid.class);
final Prebid mockPrebid = mock(Prebid.class);
when(mockPrebid.getTargeting()).thenReturn(new HashMap<>());
when(mockBid.getPrebid()).thenReturn(mockPrebid);
when(mockBid.getPrice()).thenReturn(0.2);
mEventHandler.requestAdWithBid(mockBid);
assertTrue(getExpectingAppEventStatus());
when(mockBid.getPrice()).thenReturn(0.0);
mEventHandler.requestAdWithBid(mockBid);
assertFalse(getExpectingAppEventStatus());
mEventHandler.requestAdWithBid(null);
assertFalse(getExpectingAppEventStatus());
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid 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));
}
Aggregations