use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class MoPubMediationUtilsMethodsTest method setResponseToLocalExtrasInBanner_MoPubViewSetsResponseId.
@Test
public void setResponseToLocalExtrasInBanner_MoPubViewSetsResponseId() {
BidResponse bidResponse = new BidResponse(TestResponse.getResponse());
bannerUtils.setResponseToLocalExtras(bidResponse);
HashMap<String, String> responseId = new HashMap<>();
responseId.put("PREBID_BID_RESPONSE_ID", "id");
verify(mMoPubView).setLocalExtras(responseId);
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class KeywordsSetupTest method setResponseToMoPubLocalExtrasWithMoPubBannerOrInterstitialView_ResponseStoredInLocalExtras.
@Test
public void setResponseToMoPubLocalExtrasWithMoPubBannerOrInterstitialView_ResponseStoredInLocalExtras() {
MoPubView moPubView = new MoPubView(mActivity);
MoPubBannerMediationUtils mediationUtils = new MoPubBannerMediationUtils(moPubView);
BidResponse response = new BidResponse("{\"response\":\"test\", \"id\":\"1234\"}");
Map<String, Object> expectedLocalExtras = Collections.singletonMap(KEY_BID_RESPONSE, response.getId());
mediationUtils.setResponseToLocalExtras(response);
assertEquals(expectedLocalExtras, moPubView.getLocalExtras());
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class MoPubMediationUtilsWithAdUnitsTest method whenOnResponseReceived_UpdateHashMapAndBidCache.
@Test
public void whenOnResponseReceived_UpdateHashMapAndBidCache() {
String responseString = TestResponse.getResponse();
HashMap<String, String> keywordsMap = TestResponse.getKeywordsMap();
BidResponse bidResponse = new BidResponse(responseString);
OnFetchCompleteListener mockListener = mock(OnFetchCompleteListener.class);
MoPubRewardedVideoMediationUtils mediationUtils = mock(MoPubRewardedVideoMediationUtils.class);
OpenMediationRewardedVideoAdUnit adUnit = new OpenMediationRewardedVideoAdUnit(context, "mopub", mediationUtils);
WhiteBox.setInternalState(adUnit, "mBidLoader", mMockBidLoader);
adUnit.fetchDemand(mockListener);
adUnit.onResponse(bidResponse);
verify(mockListener).onComplete(FetchDemandResult.SUCCESS);
verify(mediationUtils).handleKeywordsUpdate(keywordsMap);
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse 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));
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class BannerViewTest method loadAd_bidResponseIsInitialized.
@Test
public void loadAd_bidResponseIsInitialized() {
mBannerView.loadAd();
BidResponse response = mBannerView.getBidResponse();
System.out.println(response);
}
Aggregations