use of org.prebid.mobile.rendering.listeners.VideoCreativeViewListener in project prebid-mobile-android by prebid.
the class ViewPoolTest method getUnoccupiedViewTest.
@Test
public void getUnoccupiedViewTest() throws AdException {
VideoCreativeViewListener mockVideoCreativeViewListener = mock(VideoCreativeViewListener.class);
AdConfiguration.AdUnitIdentifierType adType = AdConfiguration.AdUnitIdentifierType.BANNER;
InterstitialManager mockInterstitialManager = mock(InterstitialManager.class);
View result = mViewPool.getUnoccupiedView(mContext, mockVideoCreativeViewListener, adType, mockInterstitialManager);
assertEquals(mUnoccupiedView, result);
assertEquals(2, mViewPool.sizeOfOccupied());
assertEquals(0, mViewPool.sizeOfUnoccupied());
result = mViewPool.getUnoccupiedView(mContext, mockVideoCreativeViewListener, adType, mockInterstitialManager);
assertThat(result, instanceOf(PrebidWebViewBanner.class));
assertEquals(3, mViewPool.sizeOfOccupied());
assertEquals(0, mViewPool.sizeOfUnoccupied());
adType = AdConfiguration.AdUnitIdentifierType.VAST;
result = mViewPool.getUnoccupiedView(mContext, mock(VideoCreative.class), adType, mockInterstitialManager);
assertThat(result, instanceOf(ExoPlayerView.class));
assertEquals(4, mViewPool.sizeOfOccupied());
assertEquals(0, mViewPool.sizeOfUnoccupied());
adType = AdConfiguration.AdUnitIdentifierType.INTERSTITIAL;
result = mViewPool.getUnoccupiedView(mContext, mockVideoCreativeViewListener, adType, mockInterstitialManager);
assertThat(result, instanceOf(PrebidWebViewInterstitial.class));
assertEquals(5, mViewPool.sizeOfOccupied());
assertEquals(0, mViewPool.sizeOfUnoccupied());
}
Aggregations