Search in sources :

Example 1 with VideoView

use of org.prebid.mobile.rendering.bidding.display.VideoView 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());
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) ArgumentCaptor(org.mockito.ArgumentCaptor) VideoView(org.prebid.mobile.rendering.bidding.display.VideoView) TransactionManager(org.prebid.mobile.rendering.loading.TransactionManager) InterstitialView(org.prebid.mobile.rendering.bidding.display.InterstitialView) View(android.view.View) VideoCreativeView(org.prebid.mobile.rendering.video.VideoCreativeView) VideoView(org.prebid.mobile.rendering.bidding.display.VideoView) Test(org.junit.Test)

Example 2 with VideoView

use of org.prebid.mobile.rendering.bidding.display.VideoView in project prebid-mobile-android by prebid.

the class InterstitialManagerTest method displayVideoAdViewInInterstitial_ExecuteVideoAdViewShow.

@Test
public void displayVideoAdViewInInterstitial_ExecuteVideoAdViewShow() {
    VideoView mockVideoAdView = mock(VideoView.class);
    mSpyInterstitialManager.displayVideoAdViewInInterstitial(mContext, mockVideoAdView);
    verify(mMockAdViewDelegate).showInterstitial();
}
Also used : VideoView(org.prebid.mobile.rendering.bidding.display.VideoView) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 VideoView (org.prebid.mobile.rendering.bidding.display.VideoView)2 View (android.view.View)1 ArgumentCaptor (org.mockito.ArgumentCaptor)1 InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)1 TransactionManager (org.prebid.mobile.rendering.loading.TransactionManager)1 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)1 VideoCreativeView (org.prebid.mobile.rendering.video.VideoCreativeView)1