use of org.prebid.mobile.rendering.bidding.data.bid.Bid 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.Bid 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.Bid 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.Bid 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);
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class DisplayViewTest method setup.
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(DisplayViewTest.this);
mContext = Robolectric.buildActivity(Activity.class).create().get();
mAdUnitConfiguration = new AdConfiguration();
mAdUnitConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
BidResponse mockResponse = mock(BidResponse.class);
Bid mockBid = mock(Bid.class);
when(mockBid.getAdm()).thenReturn("adm");
when(mockResponse.getWinningBid()).thenReturn(mockBid);
mDisplayView = new DisplayView(mContext, mMockDisplayViewListener, mAdUnitConfiguration, mockResponse);
reset(mMockDisplayViewListener);
}
Aggregations