MoPubNative { public void makeRequest() { makeRequest((RequestParameters)null); } @Deprecated  MoPubNative(@NonNull final Context context,
            @NonNull final String adUnitId,
            @NonNull final MoPubNativeListener moPubNativeListener);  MoPubNative(@NonNull final Context context,
                @NonNull final String adUnitId,
                @NonNull final MoPubNativeNetworkListener moPubNativeNetworkListener); void setNativeEventListener(@Nullable final MoPubNativeEventListener nativeEventListener); void destroy(); void setLocalExtras(@Nullable final Map<String, Object> localExtras); void makeRequest(); void makeRequest(@Nullable final RequestParameters requestParameters); void makeRequest(@Nullable final RequestParameters requestParameters,
            @Nullable Integer sequenceNumber);  }
@Ignore("fix concurrency issues") @Test public void makeRequest_whenGooglePlayServicesIsLinkedAndAdInfoIsNotCached_shouldCacheAdInfoBeforeFetchingAd() throws Exception { SharedPreferencesHelper.getSharedPreferences(context).edit().clear().commit(); GpsHelperTest.verifyCleanClientMetadata(context); GpsHelper.setClassNamesForTesting(); GpsHelperTest.TestAdInfo adInfo = new GpsHelperTest.TestAdInfo(); when(methodBuilder.setStatic(any(Class.class))).thenReturn(methodBuilder); when(methodBuilder.addParam(any(Class.class), any())).thenReturn(methodBuilder); when(methodBuilder.execute()).thenReturn( GpsHelper.GOOGLE_PLAY_SUCCESS_CODE, adInfo, adInfo.ADVERTISING_ID, adInfo.LIMIT_AD_TRACKING_ENABLED ); subject.makeRequest(nativeGpsHelperListener); semaphore.acquire(); verify(nativeGpsHelperListener).onFetchAdInfoCompleted(); GpsHelperTest.verifyClientMetadata(context, adInfo); }
@Test public void makeRequest_whenGooglePlayServicesIsNotLinked_shouldFetchAdFast() throws Exception { SharedPreferencesHelper.getSharedPreferences(context).edit().clear().commit(); GpsHelperTest.verifyCleanClientMetadata(context); GpsHelper.setClassNamesForTesting(); when(methodBuilder.setStatic(any(Class.class))).thenReturn(methodBuilder); when(methodBuilder.addParam(any(Class.class), any())).thenReturn(methodBuilder); when(methodBuilder.execute()).thenReturn(GpsHelper.GOOGLE_PLAY_SUCCESS_CODE + 1); subject.makeRequest(nativeGpsHelperListener); verify(nativeGpsHelperListener).onFetchAdInfoCompleted(); GpsHelperTest.verifyCleanClientMetadata(context); }
@Test public void makeRequest_whenGooglePlayServicesIsLinkedAndAdInfoIsCached_shouldFetchAdFast() throws Exception { GpsHelperTest.TestAdInfo adInfo = new GpsHelperTest.TestAdInfo(); GpsHelperTest.populateAndVerifyClientMetadata(context, adInfo); GpsHelper.setClassNamesForTesting(); when(methodBuilder.setStatic(any(Class.class))).thenReturn(methodBuilder); when(methodBuilder.addParam(any(Class.class), any())).thenReturn(methodBuilder); when(methodBuilder.execute()).thenReturn( GpsHelper.GOOGLE_PLAY_SUCCESS_CODE ); subject.makeRequest(nativeGpsHelperListener); verify(nativeGpsHelperListener).onFetchAdInfoCompleted(); GpsHelperTest.verifyClientMetadata(context, adInfo); }