use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class CreativeModelMakerBidsTest method whenMakeModelsAndBidResponseWithError_CallErrorListener.
@Test
public void whenMakeModelsAndBidResponseWithError_CallErrorListener() {
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.hasParseError()).thenReturn(true);
mModelMakerBids.makeModels(null, mockResponse);
verify(mMockLoadListener).onFailedToLoadAd(any(AdException.class), any());
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class VideoViewTest method loadAd_LoadBidTransaction.
@Test
public void loadAd_LoadBidTransaction() {
final AdConfiguration adUnitConfiguration = new AdConfiguration();
final BidResponse bidResponse = new BidResponse("");
mVideoView.loadAd(adUnitConfiguration, bidResponse);
verify(mMockAdViewManager).loadBidTransaction(adUnitConfiguration, bidResponse);
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class RewardedAdUnitTest method onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd.
@Test
public void onFailedAndWithWinnerBid_ExecuteInterstitialControllerLoadAd() throws IllegalAccessException {
final BidResponse mockBidResponse = mock(BidResponse.class);
final InterstitialController mockInterstitialController = mock(InterstitialController.class);
final Bid mockBid = mock(Bid.class);
final RewardedVideoEventListener spyEventListener = spy(getEventListener());
when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
WhiteBox.setInternalState(mRewardedAdUnit, "mBidResponse", mockBidResponse);
WhiteBox.setInternalState(mRewardedAdUnit, "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 BidResponseCacheTest method whenPopBidResponse_ShouldReturnBidResponse_ShouldRemoveMappings.
@Test
public void whenPopBidResponse_ShouldReturnBidResponse_ShouldRemoveMappings() {
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.getId()).thenReturn("id");
long time = System.currentTimeMillis();
when(mockResponse.getCreationTime()).thenReturn(time);
BidResponseCache.getInstance().putBidResponse(mockResponse);
final BidResponse result = BidResponseCache.getInstance().popBidResponse("id");
assertTrue(BidResponseCache.getCachedBidResponses().isEmpty());
assertEquals(mockResponse, result);
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class BidResponseCacheTest method whenPutBidResponse_WithMaxSizeReached_ShouldIgnoreStoreRequest.
@Test
public void whenPutBidResponse_WithMaxSizeReached_ShouldIgnoreStoreRequest() {
for (int i = 0; i < BidResponseCache.MAX_SIZE; i++) {
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.getId()).thenReturn("id" + Math.random());
when(mockResponse.getCreationTime()).thenReturn(System.currentTimeMillis());
BidResponseCache.getInstance().putBidResponse(mockResponse);
}
final Map<String, BidResponse> cachedTransactions = BidResponseCache.getCachedBidResponses();
assertEquals(BidResponseCache.MAX_SIZE, cachedTransactions.size());
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.getId()).thenReturn("id" + System.currentTimeMillis());
BidResponseCache.getInstance().putBidResponse(mockResponse);
assertEquals(BidResponseCache.MAX_SIZE, cachedTransactions.size());
}
Aggregations