use of org.prebid.mobile.mopub.mock.OpenMediationBaseAdUnit in project prebid-mobile-android by prebid.
the class MoPubMediationUtilsWithAdUnitsTest method whenOnResponseReceived_UpdateMoPubAndSuccessResult.
@Test
public void whenOnResponseReceived_UpdateMoPubAndSuccessResult() {
String testConfigId = "configId";
String responseString = TestResponse.getResponse();
HashMap<String, String> keywordsMap = TestResponse.getKeywordsMap();
BidResponse bidResponse = new BidResponse(responseString);
OnFetchCompleteListener mockListener = mock(OnFetchCompleteListener.class);
MoPubBannerMediationUtils bannerUtils = mock(MoPubBannerMediationUtils.class);
OpenMediationBaseAdUnit adUnit = new OpenMediationBaseAdUnit(context, testConfigId, mockAdSize, bannerUtils);
WhiteBox.setInternalState(adUnit, "mBidLoader", mMockBidLoader);
adUnit.fetchDemand(mockListener);
adUnit.onResponseReceived(bidResponse);
verify(mockListener).onComplete(FetchDemandResult.SUCCESS);
verify(bannerUtils).setResponseToLocalExtras(bidResponse);
verify(bannerUtils).handleKeywordsUpdate(keywordsMap);
assertNotNull(BidResponseCache.getInstance().popBidResponse(bidResponse.getId()));
}
Aggregations