Search in sources :

Example 26 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class TransactionManagerTest method whenOnFailedToLoad_NotifyListener.

@Test
public void whenOnFailedToLoad_NotifyListener() {
    mTransactionManager.onFailedToLoadAd(new AdException("", ""), "");
    verify(mMockListener).onFetchingFailed(any(AdException.class));
}
Also used : AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 27 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class TransactionManagerTest method whenOnTransactionFailed_CallListener.

@Test
public void whenOnTransactionFailed_CallListener() {
    mTransactionManager.onTransactionFailure(new AdException("", ""), "");
    verify(mMockListener).onFetchingFailed(any(AdException.class));
}
Also used : AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 28 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class VastParserExtractorTest method extractAndWrapperLimitReached_CallOnFailedToLoad.

@Test
public void extractAndWrapperLimitReached_CallOnFailedToLoad() throws IllegalAccessException, IOException {
    String responseString = ResourceUtils.convertResourceToString("vast_wrapper_linear_nonlinear.xml");
    WhiteBox.field(VastParserExtractor.class, "mVastWrapperCount").set(mVastParserExtractor, 5);
    final AdException exception = new AdException(INTERNAL_ERROR, WRAPPER_LIMIT_REACH_ERROR.toString());
    mVastParserExtractor.extract(responseString);
    ArgumentCaptor<VastExtractorResult> argument = ArgumentCaptor.forClass(VastExtractorResult.class);
    verify(mMockListener).onResult(argument.capture());
    final VastExtractorResult value = argument.getValue();
    assertTrue(value.hasException());
    assertEquals(exception.getMessage(), value.getAdException().getMessage());
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) VastExtractorResult(org.prebid.mobile.rendering.models.internal.VastExtractorResult) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 29 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class BannerViewTest method onFailedAndWithWinnerBid_AdRequestStatusIsFinishedNotifyPrebidSdkWin.

@Test
public void onFailedAndWithWinnerBid_AdRequestStatusIsFinishedNotifyPrebidSdkWin() {
    changePrimaryAdServerRequestStatus(true);
    final BidResponse mockBidResponse = mock(BidResponse.class);
    final Bid mockBid = mock(Bid.class);
    final BannerEventListener spyEventListener = spy(getBannerEventListener());
    when(mockBidResponse.getWinningBid()).thenReturn(mockBid);
    when(mockBidResponse.getWinningBidWidthHeightPairDips(any())).thenReturn(Pair.create(0, 0));
    mBannerView.setBidResponse(mockBidResponse);
    spyEventListener.onAdFailed(new AdException(AdException.INTERNAL_ERROR, "Test"));
    assertFalse(mBannerView.isPrimaryAdServerRequestInProgress());
    verify(spyEventListener, times(1)).onPrebidSdkWin();
}
Also used : BannerEventListener(org.prebid.mobile.rendering.bidding.listeners.BannerEventListener) BidResponse(org.prebid.mobile.rendering.bidding.data.bid.BidResponse) Bid(org.prebid.mobile.rendering.bidding.data.bid.Bid) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Example 30 with AdException

use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.

the class BannerViewTest method whenDisplayViewOnAdFailed_CallBannerListenerOnAdFailed.

@Test
public void whenDisplayViewOnAdFailed_CallBannerListenerOnAdFailed() throws IllegalAccessException {
    getDisplayViewListener().onAdFailed(new AdException(AdException.INTERNAL_ERROR, ""));
    verify(mMockBannerListener).onAdFailed(eq(mBannerView), any(AdException.class));
}
Also used : AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Aggregations

AdException (org.prebid.mobile.rendering.errors.AdException)54 Test (org.junit.Test)25 InterstitialController (org.prebid.mobile.rendering.bidding.display.InterstitialController)7 AdConfiguration (org.prebid.mobile.rendering.models.AdConfiguration)6 AdError (com.google.android.gms.ads.AdError)5 BidResponse (org.prebid.mobile.rendering.bidding.data.bid.BidResponse)5 Bid (org.prebid.mobile.rendering.bidding.data.bid.Bid)4 InterstitialControllerListener (org.prebid.mobile.rendering.bidding.interfaces.InterstitialControllerListener)4 CreativeModel (org.prebid.mobile.rendering.models.CreativeModel)4 InterstitialManager (org.prebid.mobile.rendering.views.interstitial.InterstitialManager)4 Context (android.content.Context)2 Bundle (android.os.Bundle)2 NonNull (androidx.annotation.NonNull)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 InterstitialView (org.prebid.mobile.rendering.bidding.display.InterstitialView)2 BannerEventListener (org.prebid.mobile.rendering.bidding.listeners.BannerEventListener)2 InterstitialEventListener (org.prebid.mobile.rendering.bidding.listeners.InterstitialEventListener)2 RewardedVideoEventListener (org.prebid.mobile.rendering.bidding.listeners.RewardedVideoEventListener)2 VastExtractorResult (org.prebid.mobile.rendering.models.internal.VastExtractorResult)2