use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method creativeWasClickedTest.
@Test
public void creativeWasClickedTest() {
AbstractCreative mockCreative = mock(AbstractCreative.class);
mAdViewManager.creativeWasClicked(mockCreative, "test");
verify(mMockAdViewListener).creativeClicked(eq("test"));
}
use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method showTest.
@Test
public void showTest() throws Exception {
AbstractCreative mock = mock(AbstractCreative.class);
when(mock.getCreativeView()).thenReturn(mock(View.class));
TransactionManager mockTransactionManager = mock(TransactionManager.class);
when(mockTransactionManager.getCurrentCreative()).thenReturn(mock);
WhiteBox.field(AdViewManager.class, "mTransactionManager").set(mAdViewManager, mockTransactionManager);
mAdViewManager.show();
verify(mMockAdViewListener).viewReadyForImmediateDisplay(any(View.class));
}
use of org.prebid.mobile.rendering.models.AbstractCreative in project prebid-mobile-android by prebid.
the class AdViewManagerTest method whenBannerHtmlNotResolved_Return.
@Test
public void whenBannerHtmlNotResolved_Return() throws IllegalAccessException, AdException {
ViewGroup mockBanner = mock(ViewGroup.class);
mAdViewManager = new AdViewManager(mContext, mMockAdViewListener, mockBanner, mock(InterstitialManager.class));
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 AdViewManagerTest method whenInterstitialVideoNotResolved_Return.
@Test
public void whenInterstitialVideoNotResolved_Return() throws IllegalAccessException {
AbstractCreative mockCreative = mock(AbstractCreative.class);
when(mockCreative.isDisplay()).thenReturn(false);
when(mockCreative.isVideo()).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 AdViewManagerTest method whenVideoNotResolved_Return.
@Test
public void whenVideoNotResolved_Return() throws AdException, IllegalAccessException {
VideoView mockVideoView = mock(VideoView.class);
mAdViewManager = new AdViewManager(mContext, mMockAdViewListener, mockVideoView, mock(InterstitialManager.class));
AbstractCreative mockCreative = mock(AbstractCreative.class);
when(mockCreative.isVideo()).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());
}
Aggregations