Search in sources :

Example 1 with OpenMediationRewardedVideoAdUnit

use of org.prebid.mobile.mopub.mock.OpenMediationRewardedVideoAdUnit 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);
}
Also used : MoPubRewardedVideoMediationUtils(com.mopub.mediation.MoPubRewardedVideoMediationUtils) OnFetchCompleteListener(org.prebid.mobile.rendering.bidding.listeners.OnFetchCompleteListener) OpenMediationRewardedVideoAdUnit(org.prebid.mobile.mopub.mock.OpenMediationRewardedVideoAdUnit) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Test(org.junit.Test)

Aggregations

MoPubRewardedVideoMediationUtils (com.mopub.mediation.MoPubRewardedVideoMediationUtils)1 Test (org.junit.Test)1 OpenMediationRewardedVideoAdUnit (org.prebid.mobile.mopub.mock.OpenMediationRewardedVideoAdUnit)1 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)1 OnFetchCompleteListener (org.prebid.mobile.rendering.bidding.listeners.OnFetchCompleteListener)1