use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method whenInterstitialHtmlNotResolved_Return.
@Test
public void whenInterstitialHtmlNotResolved_Return() throws IllegalAccessException {
AbstractCreative mockCreative = mock(AbstractCreative.class);
when(mockCreative.isDisplay()).thenReturn(true);
when(mockCreative.isResolved()).thenReturn(false);
WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(mAdViewManager, mockCreative);
TransactionManager mockTransactionManager = mock(TransactionManager.class);
when(mockTransactionManager.getCurrentCreative()).thenReturn(mockCreative);
WhiteBox.field(AdViewManager.class, "mTransactionManager").set(mAdViewManager, mockTransactionManager);
ArgumentCaptor exceptionCaptor = ArgumentCaptor.forClass(AdException.class);
mAdViewManager.show();
verify(mMockAdViewListener, never()).viewReadyForImmediateDisplay(any(View.class));
verify(mMockAdViewListener).failedToLoad((AdException) exceptionCaptor.capture());
assertEquals("SDK internal error: Creative has not been resolved yet", ((AdException) exceptionCaptor.getValue()).getMessage());
}
use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class InterstitialVideoTest method whenVastAndSscOffsetPresent_UseSscOffset.
@Test
public void whenVastAndSscOffsetPresent_UseSscOffset() throws Exception {
Context context = mock(Context.class);
AdViewManager adViewManager = new AdViewManager(context, mock(AdViewManagerListener.class), mMockAdView, mMockInterstitialManager);
AdConfiguration adConfiguration = adViewManager.getAdConfiguration();
adConfiguration.setVideoSkipOffset(10000);
AbstractCreative mockCreative = mock(AbstractCreative.class);
VideoCreativeModel mockModel = mock(VideoCreativeModel.class);
when(mockModel.getSkipOffset()).thenReturn(20000L);
when(mockCreative.getCreativeModel()).thenReturn(mockModel);
WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(adViewManager, mockCreative);
when(mMockAdView.getMediaOffset()).thenReturn(adViewManager.getSkipOffset());
mSpyInterstitialVideo.scheduleShowCloseBtnTask(mMockAdView);
verify(mSpyInterstitialVideo).scheduleTimer(10L * 1000);
}
use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method creativeDidCollapseTest.
@Test
public void creativeDidCollapseTest() {
AbstractCreative mockCreative = mock(AbstractCreative.class);
mAdViewManager.creativeDidCollapse(mockCreative);
verify(mMockAdViewListener).creativeCollapsed();
}
use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method creativeDidExpandTest.
@Test
public void creativeDidExpandTest() {
AbstractCreative mockCreative = mock(AbstractCreative.class);
mAdViewManager.creativeDidExpand(mockCreative);
verify(mMockAdViewListener).creativeExpanded();
}
use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method whenFetchedSuccessful_ProcessTransaction.
@Test
public void whenFetchedSuccessful_ProcessTransaction() {
Transaction mockTransaction = mock(Transaction.class);
CreativeFactory mockFactory = mock(CreativeFactory.class);
AbstractCreative mockCreative = mock(AbstractCreative.class);
when(mockFactory.getCreative()).thenReturn(mockCreative);
List<CreativeFactory> creativeFactories = new ArrayList<>();
creativeFactories.add(mockFactory);
when(mockTransaction.getTransactionState()).thenReturn("state");
when(mockTransaction.getCreativeFactories()).thenReturn(creativeFactories);
mAdViewManager.onFetchingCompleted(mockTransaction);
verify(mockCreative).createOmAdSession();
verify(mMockAdViewListener).adLoaded(any(AdDetails.class));
}
Aggregations