Search in sources :

Example 11 with VideoCreativeModel

use of org.prebid.mobile.rendering.video.VideoCreativeModel in project prebid-mobile-android by prebid.

the class AdViewManagerTest method testInterstitialClosed.

@Test
public void testInterstitialClosed() throws IllegalAccessException {
    assertFalse(mAdViewManager.isInterstitialClosed());
    VideoCreative videoCreative = mock(VideoCreative.class);
    final VideoCreativeModel videoCreativeModel = mock(VideoCreativeModel.class);
    when(videoCreative.getCreativeModel()).thenReturn(videoCreativeModel);
    when(videoCreative.isInterstitialClosed()).thenReturn(true);
    WhiteBox.field(AdViewManager.class, "mCurrentCreative").set(mAdViewManager, videoCreative);
    assertTrue(mAdViewManager.isInterstitialClosed());
    when(videoCreativeModel.hasEndCard()).thenReturn(false);
    WhiteBox.field(VideoCreative.class, "mModel").set(videoCreative, videoCreativeModel);
    when(videoCreative.isInterstitialClosed()).then(new Answer<Object>() {

        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            videoCreativeModel.trackVideoEvent(VideoAdEvent.Event.AD_CLOSE);
            return null;
        }
    });
    mAdViewManager.isInterstitialClosed();
    verify(videoCreativeModel).trackVideoEvent(VideoAdEvent.Event.AD_CLOSE);
}
Also used : VideoCreative(org.prebid.mobile.rendering.video.VideoCreative) InvocationOnMock(org.mockito.invocation.InvocationOnMock) VideoCreativeModel(org.prebid.mobile.rendering.video.VideoCreativeModel) Test(org.junit.Test)

Aggregations

VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)11 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)5 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)5 VideoAdEvent (org.prebid.mobile.rendering.video.VideoAdEvent)5 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)4 VideoCreative (org.prebid.mobile.rendering.video.VideoCreative)4 Context (android.content.Context)3 AdViewManager (org.prebid.mobile.rendering.views.AdViewManager)3 AdViewManagerListener (org.prebid.mobile.rendering.views.AdViewManagerListener)3 AdException (org.prebid.mobile.rendering.errors.AdException)2 VastExtractorResult (org.prebid.mobile.rendering.models.internal.VastExtractorResult)2 BaseNetworkTask (org.prebid.mobile.rendering.networking.BaseNetworkTask)2 AdResponseParserBase (org.prebid.mobile.rendering.parser.AdResponseParserBase)2 AdResponseParserVast (org.prebid.mobile.rendering.parser.AdResponseParserVast)2 Handler (android.os.Handler)1 HashMap (java.util.HashMap)1 HttpUrl (okhttp3.HttpUrl)1 MockResponse (okhttp3.mockwebserver.MockResponse)1 MockWebServer (okhttp3.mockwebserver.MockWebServer)1