use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class TransactionManagerTest method whenFetchBidTransaction_AttemptToMakeModels.
@Test
public void whenFetchBidTransaction_AttemptToMakeModels() {
BidResponse mockBidResponse = mock(BidResponse.class);
when(mockBidResponse.getWinningBid()).thenReturn(mock(Bid.class));
when(mockBidResponse.getWinningBid().getAdm()).thenReturn("adm");
mTransactionManager.fetchBidTransaction(mock(AdConfiguration.class), mockBidResponse);
verify(mMockListener).onFetchingFailed(any(AdException.class));
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class DisplayViewTest method setup.
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(DisplayViewTest.this);
mContext = Robolectric.buildActivity(Activity.class).create().get();
mAdUnitConfiguration = new AdConfiguration();
mAdUnitConfiguration.setAdUnitIdentifierType(AdConfiguration.AdUnitIdentifierType.BANNER);
BidResponse mockResponse = mock(BidResponse.class);
Bid mockBid = mock(Bid.class);
when(mockBid.getAdm()).thenReturn("adm");
when(mockResponse.getWinningBid()).thenReturn(mockBid);
mDisplayView = new DisplayView(mContext, mMockDisplayViewListener, mAdUnitConfiguration, mockResponse);
reset(mMockDisplayViewListener);
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class InterstitialControllerTest method loadAd_ExecuteInterstitialViewLoadAd.
@Test
public void loadAd_ExecuteInterstitialViewLoadAd() {
final AdConfiguration mockAdUnitConfiguration = mock(AdConfiguration.class);
final BidResponse mockBidResponse = mock(BidResponse.class);
mInterstitialController.loadAd(mockAdUnitConfiguration, mockBidResponse);
verify(mMockInterstitialView, times(1)).loadAd(eq(mockAdUnitConfiguration), eq(mockBidResponse));
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class BidResponseCacheTest method whenPutBidResponse_ShouldPopulateMap.
@Test
public void whenPutBidResponse_ShouldPopulateMap() {
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.getId()).thenReturn("id");
BidResponseCache.getInstance().putBidResponse(mockResponse);
final Map<String, BidResponse> cachedResponses = BidResponseCache.getCachedBidResponses();
assertEquals(1, cachedResponses.size());
assertEquals(mockResponse, cachedResponses.get("id"));
}
use of org.prebid.mobile.rendering.bidding.data.bid.BidResponse in project prebid-mobile-android by prebid.
the class BidResponseCacheTest method whenPutBidResponse_WithStaleResponsePresent_RemoveStaleResponse.
@Test
public void whenPutBidResponse_WithStaleResponsePresent_RemoveStaleResponse() {
final Map<String, BidResponse> cachedTransactions = BidResponseCache.getCachedBidResponses();
for (int i = 0; i < 5; i++) {
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.getId()).thenReturn("id" + Math.random());
when(mockResponse.getCreationTime()).thenReturn(System.currentTimeMillis() - 61 * 1000);
cachedTransactions.put("id" + Math.random(), mockResponse);
}
assertEquals(5, cachedTransactions.size());
BidResponse mockResponse = mock(BidResponse.class);
when(mockResponse.getId()).thenReturn("id" + System.currentTimeMillis());
when(mockResponse.getCreationTime()).thenReturn(System.currentTimeMillis());
BidResponseCache.getInstance().putBidResponse(mockResponse);
assertEquals(1, cachedTransactions.size());
}
Aggregations