use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class GamBannerEventHandlerTest method requestAdWithDifferentBids_VerifyAdStatus.
@Test
public void requestAdWithDifferentBids_VerifyAdStatus() {
final Bid mockBid = mock(Bid.class);
final Prebid mockPrebid = mock(Prebid.class);
when(mockPrebid.getTargeting()).thenReturn(new HashMap<>());
when(mockBid.getPrebid()).thenReturn(mockPrebid);
when(mockBid.getPrice()).thenReturn(0.2);
mBannerEventHandler.requestAdWithBid(mockBid);
assertTrue(getExpectingAppEventStatus());
when(mockBid.getPrice()).thenReturn(0.0);
mBannerEventHandler.requestAdWithBid(mockBid);
assertFalse(getExpectingAppEventStatus());
mBannerEventHandler.requestAdWithBid(null);
assertFalse(getExpectingAppEventStatus());
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class CreativeModelMakerBidsTest method whenMakeModelsAndBidRequestContainsAcjAd_CreateAcjModel.
@Test
public void whenMakeModelsAndBidRequestContainsAcjAd_CreateAcjModel() throws IOException {
AdConfiguration configuration = new AdConfiguration();
configuration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
String responseString = ResourceUtils.convertResourceToString("bidding_response_obj.json");
BidResponse bidResponse = new BidResponse(responseString);
ArgumentCaptor<CreativeModelsMaker.Result> resultArgumentCaptor = ArgumentCaptor.forClass(CreativeModelsMaker.Result.class);
mModelMakerBids.makeModels(configuration, bidResponse);
verify(mMockLoadListener).onCreativeModelReady(resultArgumentCaptor.capture());
CreativeModel creativeModel = resultArgumentCaptor.getValue().creativeModels.get(0);
Bid bid = bidResponse.getSeatbids().get(0).getBids().get(0);
assertEquals("HTML", creativeModel.getName());
assertEquals(bid.getAdm(), creativeModel.getHtml());
assertEquals(bid.getWidth(), creativeModel.getWidth());
assertEquals(bid.getHeight(), creativeModel.getHeight());
assertFalse(creativeModel.isRequireImpressionUrl());
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid in project prebid-mobile-android by prebid.
the class BaseInterstitialAdUnitTest method setUp.
@Before
public void setUp() throws Exception {
Context context = Robolectric.buildActivity(Activity.class).create().get();
mBaseInterstitialAdUnit = new BaseInterstitialAdUnit(context) {
@Override
void requestAdWithBid(@Nullable Bid bid) {
}
@Override
void showGamAd() {
}
@Override
void notifyAdEventListener(AdListenerEvent adListenerEvent) {
}
@Override
void notifyErrorListener(AdException exception) {
}
};
final AdConfiguration adUnitConfiguration = new AdConfiguration();
mBaseInterstitialAdUnit.init(adUnitConfiguration);
assertEquals(AdPosition.FULLSCREEN.getValue(), adUnitConfiguration.getAdPositionValue());
}
use of org.prebid.mobile.rendering.bidding.data.bid.Bid 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.Bid in project prebid-mobile-android by prebid.
the class RewardedAdUnitTest method onFetchComplete_ChangeInterstitialStateToLoadingAndRequestAdWithBid.
// region ======================= BidRequestListener tests
@Test
public void onFetchComplete_ChangeInterstitialStateToLoadingAndRequestAdWithBid() {
final BidResponse mockBidResponse = mock(BidResponse.class);
final Bid mockBid = mock(Bid.class);
when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
BidRequesterListener listener = getBidRequesterListener();
listener.onFetchCompleted(mockBidResponse);
verify(mMockRewardedEventHandler, times(1)).requestAdWithBid(eq(mockBid));
assertEquals(LOADING, mRewardedAdUnit.getAdUnitState());
}
Aggregations