@Test public void timeout_shouldSignalFailureAndInvalidateWithDefaultDelay() throws Exception { subject.loadAd(); Robolectric.idleMainLooper(CustomEventBannerAdapter.DEFAULT_BANNER_TIMEOUT_DELAY - 1); verify(moPubView, never()).loadFailUrl(eq(NETWORK_TIMEOUT)); assertThat(subject.isInvalidated()).isFalse(); Robolectric.idleMainLooper(1); verify(moPubView).loadFailUrl(eq(NETWORK_TIMEOUT)); assertThat(subject.isInvalidated()).isTrue(); }
@Test public void timeout_withNonNullAdTimeoutDelay_shouldSignalFailureAndInvalidateWithCustomDelay() throws Exception { stub(moPubView.getAdTimeoutDelay()).toReturn(77); subject.loadAd(); Robolectric.idleMainLooper(77000 - 1); verify(moPubView, never()).loadFailUrl(eq(NETWORK_TIMEOUT)); assertThat(subject.isInvalidated()).isFalse(); Robolectric.idleMainLooper(1); verify(moPubView).loadFailUrl(eq(NETWORK_TIMEOUT)); assertThat(subject.isInvalidated()).isTrue(); }