Search in sources :

Example 6 with TransactionManager

use of org.prebid.mobile.rendering.loading.TransactionManager in project prebid-mobile-android by prebid.

the class AdViewManagerTest method creativeInterstitialDidCloseTest.

@Test
public void creativeInterstitialDidCloseTest() throws IllegalAccessException {
    AbstractCreative mockCreative = mock(AbstractCreative.class);
    TransactionManager mock = mock(TransactionManager.class);
    Transaction transaction = mock(Transaction.class);
    when(mock.getCurrentTransaction()).thenReturn(transaction);
    WhiteBox.field(AdViewManager.class, "mTransactionManager").set(mAdViewManager, mock);
    mAdViewManager.creativeInterstitialDidClose(mockCreative);
    verify(mMockAdViewListener).creativeInterstitialClosed();
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) Transaction(org.prebid.mobile.rendering.loading.Transaction) TransactionManager(org.prebid.mobile.rendering.loading.TransactionManager) Test(org.junit.Test)

Example 7 with TransactionManager

use of org.prebid.mobile.rendering.loading.TransactionManager 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());
}
Also used : AbstractCreative(org.prebid.mobile.rendering.models.AbstractCreative) ArgumentCaptor(org.mockito.ArgumentCaptor) 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 8 with TransactionManager

use of org.prebid.mobile.rendering.loading.TransactionManager in project prebid-mobile-android by prebid.

the class AdViewManagerTest method destroy_Cleanup.

@Test
public void destroy_Cleanup() throws IllegalAccessException {
    setupCreative();
    TransactionManager mockTransactionManager = mock(TransactionManager.class);
    WhiteBox.field(AdViewManager.class, "mTransactionManager").set(mAdViewManager, mockTransactionManager);
    mAdViewManager.destroy();
    verify(mockTransactionManager).destroy();
    verify(mMockVideoCreative).destroy();
}
Also used : TransactionManager(org.prebid.mobile.rendering.loading.TransactionManager) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 TransactionManager (org.prebid.mobile.rendering.loading.TransactionManager)8 AbstractCreative (org.prebid.mobile.rendering.models.AbstractCreative)6 View (android.view.View)5 InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)5 VideoView (org.prebid.mobile.rendering.bidding.display.VideoView)5 VideoCreativeView (org.prebid.mobile.rendering.video.VideoCreativeView)5 ArgumentCaptor (org.mockito.ArgumentCaptor)4 Transaction (org.prebid.mobile.rendering.loading.Transaction)2 ViewGroup (android.view.ViewGroup)1 ArrayList (java.util.ArrayList)1 CreativeFactory (org.prebid.mobile.rendering.loading.CreativeFactory)1 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)1 VideoCreative (org.prebid.mobile.rendering.video.VideoCreative)1 VideoCreativeModel (org.prebid.mobile.rendering.video.VideoCreativeModel)1