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);
}
Aggregations