target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void getEnd() { long endTime = SystemClock.elapsedRealtime(); Metrics metrics = new MetricsImpl(0, endTime); assertThat(metrics.getStart()).isEqualTo(endTime); } | @Override public long getEnd() { return end; } | MetricsImpl implements Metrics { @Override public long getEnd() { return end; } } | MetricsImpl implements Metrics { @Override public long getEnd() { return end; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); } | MetricsImpl implements Metrics { @Override public long getEnd() { return end; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); } | MetricsImpl implements Metrics { @Override public long getEnd() { return end; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); } |
@Test public void testDefaultExceptionHanlder() { exceptionHanlder.uncaughtException(Thread.currentThread(), new Throwable()); verify(defaultExceptionHanlder, times(1)) .uncaughtException(any(Thread.class), any(Throwable.class)); } | @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { try { CrashReport report = CrashReportBuilder.setup(applicationContext, mapboxPackage, version) .addExceptionThread(thread) .addCaus... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... |
@Test public void testNullDefaultExceptionHanlder() { exceptionHanlder = new MapboxUncaughtExceptionHanlder(context, sharedPreferences, TELEM_MAPBOX_PACKAGE, TELEM_MAPBOX_VERSION, null); try { exceptionHanlder.uncaughtException(Thread.currentThread(), new Throwable()); } catch (Throwable throwable) { fail("Unexpected a... | @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { try { CrashReport report = CrashReportBuilder.setup(applicationContext, mapboxPackage, version) .addExceptionThread(thread) .addCaus... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... |
@Test public void getLastLocation() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<LocationEngineResult> resultRef = new AtomicReference<>(); LocationEngineCallback<LocationEngineResult> callback = getCallback(resultRef, latch); final Location location = getMockL... | @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locati... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... |
@Test public void exceptionHandlerEnabledNotMapboxCrash() { exceptionHanlder.uncaughtException(Thread.currentThread(), createThrowable("HighLevelThrowable", "A", "B")); verify(context, never()).getFilesDir(); } | @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { try { CrashReport report = CrashReportBuilder.setup(applicationContext, mapboxPackage, version) .addExceptionThread(thread) .addCaus... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void uncaughtException(Thread thread, Throwable throwable) { List<Throwable> causalChain; if (isEnabled.get() && isMapboxCrash(causalChain = getCausalChain(throwable))) { tr... |
@Test public void onSharedPreferenceChanged() { boolean isEnabled = exceptionHanlder.isEnabled(); exceptionHanlder.onSharedPreferenceChanged( getMockedSharedPrefs(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false), MAPBOX_PREF_ENABLE_CRASH_REPORTER); assertThat(exceptionHanlder.isEnabled()).isNotEqualTo(isEnabled); } | @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedPreferences.getBoolean(MAPBOX_PREF_ENABLE_CRASH_REPORTER, false)); } catch (Exception ex) { Log.e(TAG, ex.toString()); } } | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedP... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedP... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedP... | MapboxUncaughtExceptionHanlder implements Thread.UncaughtExceptionHandler,
SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!MAPBOX_PREF_ENABLE_CRASH_REPORTER.equals(key)) { return; } try { isEnabled.set(sharedP... |
@Test public void createListener() { LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); LocationListener locationListener = androidLocationEngineImpl.createListener(callback); Location mockLocation = getMockLocation(LATITUDE, LONGITUDE); locationListener.onLocationChanged(mockLo... | @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context); } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context); @NonNull @Ove... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new AndroidLocationEngineCallbackTransport(callback); } AndroidLocationEngineImpl(@NonNull Context context); @NonNull @Ove... |
@Test public void removeLocationUpdatesForInvalidListener() { LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); engine.removeLocationUpdates(callback); verify(locationManagerMock, never()).removeUpdates(any(LocationListener.class)); } | @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context context); } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context context); @NonN... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context context); @NonN... |
@Test public void removeLocationUpdatesForPendingIntent() { PendingIntent pendingIntent = mock(PendingIntent.class); engine.removeLocationUpdates(pendingIntent); verify(locationManagerMock, times(1)).removeUpdates(any(PendingIntent.class)); } | @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context context); } | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context context); @NonN... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void removeLocationUpdates(@NonNull LocationListener listener) { if (listener != null) { locationManager.removeUpdates(listener); } } AndroidLocationEngineImpl(@NonNull Context context); @NonN... |
@Test(expected = NullPointerException.class) public void getLastLocationNullCallback() { engine.getLastLocation(null); } | @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locati... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(Locatio... |
@Test(expected = NullPointerException.class) public void requestLocationUpdatesNullCallback() { engine.requestLocationUpdates(null, null, null); } | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { currentProvider = getBestProvider(request.getPriority()); locationManager.requestLocationUpdates(currentProvider... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { currentProvider = getBestProvider(re... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { currentProvider = getBestProvider(re... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { currentProvider = getBestProvider(re... | AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { currentProvider = getBestProvider(re... |
@Test public void checkNullIntent() { LocationEngineResult result = LocationEngineResult.extractResult(null); assertThat(result).isNull(); } | @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } } | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private LocationEngineRes... | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private LocationEngineRes... | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private LocationEngineRes... |
@Test public void passInvalidIntent() { Intent intent = mock(Intent.class); LocationEngineResult result = LocationEngineResult.extractResult(intent); assertThat(result).isNull(); } | @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } } | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private LocationEngineRes... | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private LocationEngineRes... | LocationEngineResult { @Nullable public static LocationEngineResult extractResult(Intent intent) { LocationEngineResult result = null; if (isOnClasspath(GOOGLE_PLAY_LOCATION_RESULT)) { result = extractGooglePlayResult(intent); } return result == null ? extractAndroidResult(intent) : result; } private LocationEngineRes... |
@Test public void passNullLocation() { Location location = null; LocationEngineResult result = LocationEngineResult.create(location); assertForNullInput(result); } | @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... |
@Test public void passNullLocationList() { List<Location> locations = null; LocationEngineResult result = LocationEngineResult.create(locations); assertForNullInput(result); } | @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... |
@Test public void getLastLocation() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); final AtomicReference<LocationEngineResult> resultRef = new AtomicReference<>(); LocationEngineCallback<LocationEngineResult> callback = getCallback(resultRef, latch); final Location location = getMockL... | @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.create(bestLastLocation)); } else { callback.onFailure(new Exception... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... |
@Test public void passValidLocation() { Location location = getValidLocation(); LocationEngineResult result = LocationEngineResult.create(location); assertForValidInput(result); } | @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... |
@Test public void passValidLocationList() { List<Location> locations = Collections.singletonList(getValidLocation()); LocationEngineResult result = LocationEngineResult.create(locations); assertForValidInput(result); } | @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... |
@Test public void passMutableLocationListWithNulls() { List<Location> locations = getLocationsWithNulls(); LocationEngineResult result = LocationEngineResult.create(locations); assertForValidInput(result); } | @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... |
@Test public void passImmutableLocationListWithNulls() { List<Location> locations = Collections.unmodifiableList(getLocationsWithNulls()); LocationEngineResult result = LocationEngineResult.create(locations); assertForValidInput(result); } | @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); } | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... | LocationEngineResult { @NonNull public static LocationEngineResult create(@Nullable Location location) { List<Location> locations = new ArrayList<>(); if (location != null) { locations.add(location); } return new LocationEngineResult(locations); } private LocationEngineResult(List<Location> locations); @NonNull static... |
@Test public void removeLocationUpdatesForInvalidListener() { LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); engine.removeLocationUpdates(callback); verify(fusedLocationProviderClientMock, never()).removeLocationUpdates(any(LocationCallback.class)); } | @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } } | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationProviderClient f... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationProviderClient f... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationProviderClient f... |
@Test public void removeLocationUpdatesForPendingIntent() { PendingIntent pendingIntent = mock(PendingIntent.class); engine.removeLocationUpdates(pendingIntent); verify(fusedLocationProviderClientMock, times(1)) .removeLocationUpdates(any(PendingIntent.class)); } | @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } } | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationProviderClient f... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationProviderClient f... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @Override public void removeLocationUpdates(@NonNull LocationCallback listener) { if (listener != null) { fusedLocationProviderClient.removeLocationUpdates(listener); } } @VisibleForTesting GoogleLocationEngineImpl(FusedLocationProviderClient f... |
@Test(expected = NullPointerException.class) public void getLastLocationNullCallback() { engine.getLastLocation(null); } | @SuppressLint("MissingPermission") @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { GoogleLastLocationEngineCallbackTransport transport = new GoogleLastLocationEngineCallbackTransport(callback); fusedLocationProviderClient.getLastLocation()... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { GoogleLastLocationEngineCallbackTransport transport = new GoogleLastLocationEngin... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { GoogleLastLocationEngineCallbackTransport transport = new GoogleLastLocationEngin... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { GoogleLastLocationEngineCallbackTransport transport = new GoogleLastLocationEngin... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { GoogleLastLocationEngineCallbackTransport transport = new GoogleLastLocationEngin... |
@Test(expected = NullPointerException.class) public void requestLocationUpdatesNullCallback() { engine.requestLocationUpdates(null, null, null); } | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationCallback listener, @Nullable Looper looper) throws SecurityException { fusedLocationProviderClient.requestLocationUpdates(toGMSLocationRequest(request), listener, looper); } | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationCallback listener, @Nullable Looper looper) throws SecurityException { fusedLocationProviderClient.requestLo... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationCallback listener, @Nullable Looper looper) throws SecurityException { fusedLocationProviderClient.requestLo... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationCallback listener, @Nullable Looper looper) throws SecurityException { fusedLocationProviderClient.requestLo... | GoogleLocationEngineImpl implements LocationEngineImpl<LocationCallback> { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationCallback listener, @Nullable Looper looper) throws SecurityException { fusedLocationProviderClient.requestLo... |
@Test public void checkDaySinceLastUpdate() { assertTrue(configurationClient.shouldUpdate()); } | boolean shouldUpdate() { SharedPreferences sharedPreferences = TelemetryUtils.obtainSharedPreferences(context); long lastUpdateTime = sharedPreferences.getLong(MAPBOX_CONFIG_SYNC_KEY_TIMESTAMP, 0); long millisecondDiff = System.currentTimeMillis() - lastUpdateTime; return millisecondDiff >= DAY_IN_MILLIS; } | ConfigurationClient implements Callback { boolean shouldUpdate() { SharedPreferences sharedPreferences = TelemetryUtils.obtainSharedPreferences(context); long lastUpdateTime = sharedPreferences.getLong(MAPBOX_CONFIG_SYNC_KEY_TIMESTAMP, 0); long millisecondDiff = System.currentTimeMillis() - lastUpdateTime; return milli... | ConfigurationClient implements Callback { boolean shouldUpdate() { SharedPreferences sharedPreferences = TelemetryUtils.obtainSharedPreferences(context); long lastUpdateTime = sharedPreferences.getLong(MAPBOX_CONFIG_SYNC_KEY_TIMESTAMP, 0); long millisecondDiff = System.currentTimeMillis() - lastUpdateTime; return milli... | ConfigurationClient implements Callback { boolean shouldUpdate() { SharedPreferences sharedPreferences = TelemetryUtils.obtainSharedPreferences(context); long lastUpdateTime = sharedPreferences.getLong(MAPBOX_CONFIG_SYNC_KEY_TIMESTAMP, 0); long millisecondDiff = System.currentTimeMillis() - lastUpdateTime; return milli... | ConfigurationClient implements Callback { boolean shouldUpdate() { SharedPreferences sharedPreferences = TelemetryUtils.obtainSharedPreferences(context); long lastUpdateTime = sharedPreferences.getLong(MAPBOX_CONFIG_SYNC_KEY_TIMESTAMP, 0); long millisecondDiff = System.currentTimeMillis() - lastUpdateTime; return milli... |
@Test public void checksAppUserTurnstileType() { Event anAppUserTurnstileEvent = obtainAnAppUserTurnstileEvent(); assertEquals(Event.Type.TURNSTILE, anAppUserTurnstileEvent.obtainType()); } | @Override Type obtainType() { return Type.TURNSTILE; } | AppUserTurnstile extends Event implements Parcelable { @Override Type obtainType() { return Type.TURNSTILE; } } | AppUserTurnstile extends Event implements Parcelable { @Override Type obtainType() { return Type.TURNSTILE; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); } | AppUserTurnstile extends Event implements Parcelable { @Override Type obtainType() { return Type.TURNSTILE; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); @Nullable String getSkuId... | AppUserTurnstile extends Event implements Parcelable { @Override Type obtainType() { return Type.TURNSTILE; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); @Nullable String getSkuId... |
@Test public void createListener() { LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); LocationListener locationListener = mapboxFusedLocationEngineImpl.createListener(callback); Location mockLocation = getMockLocation(LATITUDE, LONGITUDE); locationListener.onLocationChanged(mo... | @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new MapboxLocationEngineCallbackTransport(callback); } | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new MapboxLocationEngineCallbackTransport(callback); } } | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new MapboxLocationEngineCallbackTransport(callback); } MapboxFusedLocationEngineImpl(@NonNull Context context); } | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new MapboxLocationEngineCallbackTransport(callback); } MapboxFusedLocationEngineImpl(@NonNull Context context); @NonNull @Override L... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @NonNull @Override public LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback) { return new MapboxLocationEngineCallbackTransport(callback); } MapboxFusedLocationEngineImpl(@NonNull Context context); @NonNull @Override L... |
@Test public void verifyDefaultSkuId() { AppUserTurnstile anAppUserTurnstileEvent = (AppUserTurnstile)obtainAnAppUserTurnstileEvent(); assertNull(anAppUserTurnstileEvent.getSkuId()); } | @Nullable public String getSkuId() { return skuId; } | AppUserTurnstile extends Event implements Parcelable { @Nullable public String getSkuId() { return skuId; } } | AppUserTurnstile extends Event implements Parcelable { @Nullable public String getSkuId() { return skuId; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); } | AppUserTurnstile extends Event implements Parcelable { @Nullable public String getSkuId() { return skuId; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); @Nullable String getSkuId()... | AppUserTurnstile extends Event implements Parcelable { @Nullable public String getSkuId() { return skuId; } AppUserTurnstile(String sdkIdentifier, String sdkVersion); AppUserTurnstile(String sdkIdentifier, String sdkVersion, boolean isFromPreferences); private AppUserTurnstile(Parcel in); @Nullable String getSkuId()... |
@Test public void addRxBytes() { networkUsageMetricsCollector.addRxBytes(30); verify(metrics).addRxBytesForType(anyInt(), anyLong()); } | void addRxBytes(long bytes) { metrics.addRxBytesForType(getActiveNetworkType(), bytes); } | NetworkUsageMetricsCollector { void addRxBytes(long bytes) { metrics.addRxBytesForType(getActiveNetworkType(), bytes); } } | NetworkUsageMetricsCollector { void addRxBytes(long bytes) { metrics.addRxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); } | NetworkUsageMetricsCollector { void addRxBytes(long bytes) { metrics.addRxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); } | NetworkUsageMetricsCollector { void addRxBytes(long bytes) { metrics.addRxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); } |
@Test public void addTxBytes() { networkUsageMetricsCollector.addTxBytes(30); verify(metrics).addTxBytesForType(anyInt(), anyLong()); } | void addTxBytes(long bytes) { metrics.addTxBytesForType(getActiveNetworkType(), bytes); } | NetworkUsageMetricsCollector { void addTxBytes(long bytes) { metrics.addTxBytesForType(getActiveNetworkType(), bytes); } } | NetworkUsageMetricsCollector { void addTxBytes(long bytes) { metrics.addTxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); } | NetworkUsageMetricsCollector { void addTxBytes(long bytes) { metrics.addTxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); } | NetworkUsageMetricsCollector { void addTxBytes(long bytes) { metrics.addTxBytesForType(getActiveNetworkType(), bytes); } NetworkUsageMetricsCollector(Context context, TelemetryMetrics metrics); } |
@Test public void addRxBytesForMobileType() { telemetryMetrics.addRxBytesForType(ConnectivityManager.TYPE_MOBILE, 10L); Metrics metrics = telemetryMetrics.getMetrics(TelemetryMetrics.MOBILE_BYTES_RX); assertThat(metrics.getValue()).isEqualTo(10L); } | public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); } | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... |
@Test public void addRxBytesForWifiType() { telemetryMetrics.addRxBytesForType(ConnectivityManager.TYPE_WIFI, 10L); Metrics metrics = telemetryMetrics.getMetrics(TelemetryMetrics.WIFI_BYTES_RX); assertThat(metrics.getValue()).isEqualTo(10L); } | public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); } | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... | TelemetryMetrics extends AbstractCompositeMetrics { public void addRxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_RX : MOBILE_BYTES_RX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... |
@Test public void addTxBytesForWifiType() { telemetryMetrics.addTxBytesForType(ConnectivityManager.TYPE_WIFI, 10L); Metrics metrics = telemetryMetrics.getMetrics(TelemetryMetrics.WIFI_BYTES_TX); assertThat(metrics.getValue()).isEqualTo(10L); } | public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength); } | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... |
@Test public void addTxBytesForMobileType() { telemetryMetrics.addTxBytesForType(ConnectivityManager.TYPE_MOBILE, 10L); Metrics metrics = telemetryMetrics.getMetrics(TelemetryMetrics.MOBILE_BYTES_TX); assertThat(metrics.getValue()).isEqualTo(10L); } | public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } } | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength); } | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... | TelemetryMetrics extends AbstractCompositeMetrics { public void addTxBytesForType(@IntRange(from = TYPE_MOBILE, to = TYPE_VPN) int networkType, long bytes) { if (isValidNetworkType(networkType)) { add(networkType == TYPE_WIFI ? WIFI_BYTES_TX : MOBILE_BYTES_TX, bytes); } } TelemetryMetrics(long maxLength); void addRxByt... |
@Test public void checksChinaEnvironment() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new TelemetryCl... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksChinaSwitchEnvironment() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new Telem... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksComSwitchEnvironment() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new Telemet... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void requestLocationUpdatesOutdoors() { LocationEngineRequest request = new LocationEngineRequest.Builder(10) .setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY).build(); LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); Looper looper = mock(Looper.class); w... | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) ... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... |
@Test public void checksStagingEnvironment() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new Telemetry... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksStagingAppInfoHostname() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new Telem... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksStagingAppInfoAccessToken() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new Te... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksCom() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory = new TelemetryClientFactory(a... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksDefaultComWhenAppInformationIsNull() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClientFactory... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksDefaultComWhenAppInformationMetaDataIsNull() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClien... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksDefaultComWhenErrorRetrievingAppInformation() throws Exception { String anyAccessToken = "anyAccessToken"; String anyUserAgent = "anyUserAgent"; Logger mockedLogger = mock(Logger.class); CertificateBlacklist mockedBlacklist = mock(CertificateBlacklist.class); TelemetryClientFactory telemetryClie... | TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentChain = new EnvironmentChai... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... | TelemetryClientFactory { TelemetryClient obtainTelemetryClient(Context context) { try { ApplicationInfo appInformation = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); if (appInformation != null && appInformation.metaData != null) { EnvironmentChain environmentCh... |
@Test public void checksStagingHostname() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> stagingCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.STAGING); assertTrue(stagingCertificatesPins.containsKey("... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void checksStagingGeotrustCertificatesPins() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> stagingCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.STAGING); assertTrue(stagingCertificatesPi... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void checksComHostname() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> comCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.COM); assertTrue(comCertificatesPins.containsKey("events.mapbox.co... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void requestLocationUpdatesIndoors() { LocationEngineRequest request = new LocationEngineRequest.Builder(10) .setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY).build(); LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); Looper looper = mock(Looper.class); wh... | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) ... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... |
@Test public void checksComGeotrustCertificatesPins() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> comCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.COM); assertTrue(comCertificatesPins.containsKey("... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void checksComDigiCertCertificatesPins() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> comCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.COM); assertTrue(comCertificatesPins.containsKey("... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void checksChinaHostname() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> chinaCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.CHINA); assertTrue(chinaCertificatesPins.containsKey("events.m... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void checksChinaDigiCertCertificatesPins() throws Exception { CertificatePinnerFactory certificatePinnerFactory = new CertificatePinnerFactory(); Map<String, List<String>> chinaCertificatesPins = certificatePinnerFactory .provideCertificatesPinsFor(Environment.CHINA); assertTrue(chinaCertificatesPins.conta... | Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } | CertificatePinnerFactory { Map<String, List<String>> provideCertificatesPinsFor(Environment environment) { return CERTIFICATES_PINS.get(environment); } } |
@Test public void sendsContentTypeHeader() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> mockedEvent = obtainAnEvent(); Callback ... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void sendsContentEncodingHeader() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> mockedEvent = obtainAnEvent(); Callb... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void sendsPostEventRequestWithTheCorrectAccessTokenParameter() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("theAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> mockedE... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void sendsUserAgentHeader() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "theUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> mockedEvent = obtainAnEvent(); Callback mo... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void sendsReformedUserAgentHeader() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "theUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> mockedEvent = obtainAnEvent(); Cal... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void sendsPostEventRequestToTheCorrectEndpoint() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> mockedEvent = obtainA... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void requestLocationUpdatesOutdoorsWithPendingIntent() { LocationEngineRequest request = new LocationEngineRequest.Builder(10) .setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY).build(); PendingIntent pendingIntent = mock(PendingIntent.class); when(locationManagerMock.getBestProvider(any(Criteria.c... | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) ... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... |
@Test public void sendsTheCorrectBodyPostingAnEvent() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> theEvent = obtainAnEvent(); C... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void receivesNoBodyPostingAnEventSuccessfully() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> theEvent = obtainAnEve... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void parsesUnauthorizedRequestResponseProperlyPostingAnEvent() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> theEven... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void parsesInvalidMessageBodyResponseProperlyPostingAnEvent() throws Exception { MapboxTelemetry.applicationContext = getMockedContext(); TelemetryClient telemetryClient = obtainATelemetryClient("anyAccessToken", "anyUserAgent", REFORMED_USER_AGENT, MapboxTelemetry.applicationContext); List<Event> theEvent... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void checksRequestTimeoutFailure() throws Exception { Context mockedContext = getMockedContext(); MapboxTelemetry.applicationContext = mockedContext; OkHttpClient localOkHttpClientWithShortTimeout = new OkHttpClient.Builder() .readTimeout(100, TimeUnit.MILLISECONDS) .build(); HttpUrl localUrl = obtainBaseE... | void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } } | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... | TelemetryClient { void sendEvents(List<Event> events, Callback callback, boolean serializeNulls) { sendBatch(Collections.unmodifiableList(events), callback, serializeNulls); } TelemetryClient(String accessToken, String userAgent, String reformedUserAgent, TelemetryClientSettings setting,
Logger logger... |
@Test public void checksAlarmRegistered() throws Exception { Context mockedContext = mock(Context.class); AlarmManager mockedAlarmManager = mock(AlarmManager.class); AlarmReceiver mockedAlarmReceiver = mock(AlarmReceiver.class); AlarmSchedulerFlusher theAlarmSchedulerFlusher = new AlarmSchedulerFlusher(mockedContext, m... | @Override public void register() { Intent alarmIntent = receiver.supplyIntent(); pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter filter = new IntentFilter(SCHEDULER_FLUSHER_INTENT); context.registerReceiver(receiver, filter); } | AlarmSchedulerFlusher implements SchedulerFlusher { @Override public void register() { Intent alarmIntent = receiver.supplyIntent(); pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter filter = new IntentFilter(SCHEDULER_FLUSHER_INTENT); context.registerR... | AlarmSchedulerFlusher implements SchedulerFlusher { @Override public void register() { Intent alarmIntent = receiver.supplyIntent(); pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter filter = new IntentFilter(SCHEDULER_FLUSHER_INTENT); context.registerR... | AlarmSchedulerFlusher implements SchedulerFlusher { @Override public void register() { Intent alarmIntent = receiver.supplyIntent(); pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter filter = new IntentFilter(SCHEDULER_FLUSHER_INTENT); context.registerR... | AlarmSchedulerFlusher implements SchedulerFlusher { @Override public void register() { Intent alarmIntent = receiver.supplyIntent(); pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); IntentFilter filter = new IntentFilter(SCHEDULER_FLUSHER_INTENT); context.registerR... |
@Test public void testOnResume() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); when(mockedContext.checkPermission(anyString(), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_GRANTED); locationEngineController = new LocationEngineControllerImpl(mockedContext, locationEngine, broadcastRece... | @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } } | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Loca... | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Loca... | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Loca... |
@Test public void testOnResumePermissionsDisabled() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); when(mockedContext.checkPermission(anyString(), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_DENIED); locationEngineController = new LocationEngineControllerImpl(mockedContext, locationEng... | @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } } | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Loca... | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Loca... | LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Loca... |
@Test public void testOnDestroy() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); locationEngineController = new LocationEngineControllerImpl(mockedContext, locationEngine, broadcastReceiver); locationEngineController.onDestroy(); verify(mockedContext).unregisterReceiver(any(BroadcastReceiver.class))... | @Override public void onDestroy() { removeLocationUpdates(); unregisterReceiver(); } | LocationEngineControllerImpl implements LocationEngineController { @Override public void onDestroy() { removeLocationUpdates(); unregisterReceiver(); } } | LocationEngineControllerImpl implements LocationEngineController { @Override public void onDestroy() { removeLocationUpdates(); unregisterReceiver(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Lo... | LocationEngineControllerImpl implements LocationEngineController { @Override public void onDestroy() { removeLocationUpdates(); unregisterReceiver(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Lo... | LocationEngineControllerImpl implements LocationEngineController { @Override public void onDestroy() { removeLocationUpdates(); unregisterReceiver(); } LocationEngineControllerImpl(@NonNull Context context,
@NonNull LocationEngine locationEngine,
@NonNull Lo... |
@Test public void verifyDefaultStatus() { assertThat(collectionClient.isEnabled()).isFalse(); } | boolean isEnabled() { return isEnabled.get(); } | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { boolean isEnabled() { return isEnabled.get(); } } | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { boolean isEnabled() { return isEnabled.get(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThread handlerThread,
... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { boolean isEnabled() { return isEnabled.get(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThread handlerThread,
... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { boolean isEnabled() { return isEnabled.get(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThread handlerThread,
... |
@Test public void requestLocationUpdatesIndoorsWithPendingIntent() { LocationEngineRequest request = new LocationEngineRequest.Builder(10) .setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY).build(); PendingIntent pendingIntent = mock(PendingIntent.class); when(locationManagerMock.getBestProvider(any(Criteria.cl... | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) ... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... |
@Test public void verifyDefaultInterval() { assertThat(collectionClient.getSessionRotationInterval()) .isEqualTo(TimeUnit.HOURS.toMillis(DEFAULT_SESSION_ROTATION_INTERVAL_HOURS)); } | long getSessionRotationInterval() { return sessionIdentifier.get().getInterval(); } | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { long getSessionRotationInterval() { return sessionIdentifier.get().getInterval(); } } | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { long getSessionRotationInterval() { return sessionIdentifier.get().getInterval(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThr... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { long getSessionRotationInterval() { return sessionIdentifier.get().getInterval(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThr... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { long getSessionRotationInterval() { return sessionIdentifier.get().getInterval(); } @VisibleForTesting LocationCollectionClient(@NonNull LocationEngineController collectionController,
@NonNull HandlerThr... |
@Test public void verifyInvalidKeyChangedViaSharedPrefs() { SharedPreferences mockedSharedPrefs = getMockedSharedPrefs(); collectionClient.onSharedPreferenceChanged(mockedSharedPrefs, "foo"); verifyZeroInteractions(mockedSharedPrefs); } | @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { try { if (LOCATION_COLLECTOR_ENABLED.equals(key)) { setEnabled(sharedPreferences.getBoolean(LOCATION_COLLECTOR_ENABLED, false)); } else if (SESSION_ROTATION_INTERVAL_MILLIS.equals(key)) { setSessionRotationInterval(shared... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { try { if (LOCATION_COLLECTOR_ENABLED.equals(key)) { setEnabled(sharedPreferences.getBoolean(LOCATION_COLLECTOR_ENABLED, false)); } e... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { try { if (LOCATION_COLLECTOR_ENABLED.equals(key)) { setEnabled(sharedPreferences.getBoolean(LOCATION_COLLECTOR_ENABLED, false)); } e... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { try { if (LOCATION_COLLECTOR_ENABLED.equals(key)) { setEnabled(sharedPreferences.getBoolean(LOCATION_COLLECTOR_ENABLED, false)); } e... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { try { if (LOCATION_COLLECTOR_ENABLED.equals(key)) { setEnabled(sharedPreferences.getBoolean(LOCATION_COLLECTOR_ENABLED, false)); } e... |
@Test(expected = IllegalStateException.class) public void callGetInstanceBeforeInstall() { LocationCollectionClient.getInstance(); } | @NonNull static LocationCollectionClient getInstance() { synchronized (lock) { if (locationCollectionClient != null) { return locationCollectionClient; } else { throw new IllegalStateException("LocationCollectionClient is not installed."); } } } | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @NonNull static LocationCollectionClient getInstance() { synchronized (lock) { if (locationCollectionClient != null) { return locationCollectionClient; } else { throw new IllegalStateException("LocationCollectionClient is not insta... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @NonNull static LocationCollectionClient getInstance() { synchronized (lock) { if (locationCollectionClient != null) { return locationCollectionClient; } else { throw new IllegalStateException("LocationCollectionClient is not insta... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @NonNull static LocationCollectionClient getInstance() { synchronized (lock) { if (locationCollectionClient != null) { return locationCollectionClient; } else { throw new IllegalStateException("LocationCollectionClient is not insta... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { @NonNull static LocationCollectionClient getInstance() { synchronized (lock) { if (locationCollectionClient != null) { return locationCollectionClient; } else { throw new IllegalStateException("LocationCollectionClient is not insta... |
@Test public void callUninstallBeforeInstall() { assertThat(LocationCollectionClient.uninstall()).isFalse(); } | static boolean uninstall() { boolean uninstalled = false; synchronized (lock) { if (locationCollectionClient != null) { locationCollectionClient.locationEngineController.onDestroy(); locationCollectionClient.settingsChangeHandlerThread.quit(); locationCollectionClient.sharedPreferences.unregisterOnSharedPreferenceChang... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { static boolean uninstall() { boolean uninstalled = false; synchronized (lock) { if (locationCollectionClient != null) { locationCollectionClient.locationEngineController.onDestroy(); locationCollectionClient.settingsChangeHandlerTh... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { static boolean uninstall() { boolean uninstalled = false; synchronized (lock) { if (locationCollectionClient != null) { locationCollectionClient.locationEngineController.onDestroy(); locationCollectionClient.settingsChangeHandlerTh... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { static boolean uninstall() { boolean uninstalled = false; synchronized (lock) { if (locationCollectionClient != null) { locationCollectionClient.locationEngineController.onDestroy(); locationCollectionClient.settingsChangeHandlerTh... | LocationCollectionClient implements SharedPreferences.OnSharedPreferenceChangeListener { static boolean uninstall() { boolean uninstalled = false; synchronized (lock) { if (locationCollectionClient != null) { locationCollectionClient.locationEngineController.onDestroy(); locationCollectionClient.settingsChangeHandlerTh... |
@Test public void testNullIntentOnReceive() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); broadcastReceiver.onReceive(mockedContext, null); verify(mockedContext, never()).getApplicationContext(); } | @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult result = LocationEngineResult.extractResult(intent); if (result ==... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... |
@Test public void testOnReceiveActionReturnNull() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); Intent mockedIntent = mock(Intent.class); when(mockedIntent.getAction()).thenReturn(null); broadcastReceiver.onReceive(mockedContext, mockedIntent); verify(mockedIntent, never()).getStringExtra(anyString... | @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult result = LocationEngineResult.extractResult(intent); if (result ==... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... | LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult resul... |
@Test public void checksOnPeriodRaisedCall() throws Exception { Context mockedContext = mock(Context.class); Intent mockedIntent = mock(Intent.class); when(mockedIntent.getAction()).thenReturn("com.mapbox.scheduler_flusher"); SchedulerCallback mockedSchedulerCallback = mock(SchedulerCallback.class); AlarmReceiver theAl... | @Override public void onReceive(Context context, Intent intent) { try { if (SCHEDULER_FLUSHER_INTENT.equals(intent.getAction())) { callback.onPeriodRaised(); } } catch (Throwable throwable) { Log.e(TAG, throwable.toString()); } } | AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (SCHEDULER_FLUSHER_INTENT.equals(intent.getAction())) { callback.onPeriodRaised(); } } catch (Throwable throwable) { Log.e(TAG, throwable.toString()); } } } | AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (SCHEDULER_FLUSHER_INTENT.equals(intent.getAction())) { callback.onPeriodRaised(); } } catch (Throwable throwable) { Log.e(TAG, throwable.toString()); } } AlarmReceiver(@NonNull SchedulerCallback callbac... | AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (SCHEDULER_FLUSHER_INTENT.equals(intent.getAction())) { callback.onPeriodRaised(); } } catch (Throwable throwable) { Log.e(TAG, throwable.toString()); } } AlarmReceiver(@NonNull SchedulerCallback callbac... | AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (SCHEDULER_FLUSHER_INTENT.equals(intent.getAction())) { callback.onPeriodRaised(); } } catch (Throwable throwable) { Log.e(TAG, throwable.toString()); } } AlarmReceiver(@NonNull SchedulerCallback callbac... |
@Test public void checksSupplyIntent() throws Exception { SchedulerCallback mockedSchedulerCallback = mock(SchedulerCallback.class); AlarmReceiver theAlarmReceiver = new AlarmReceiver(mockedSchedulerCallback); Intent actualAlarmIntent = theAlarmReceiver.supplyIntent(); Intent expectedAlarmIntent = new Intent("com.mapbo... | Intent supplyIntent() { return new Intent(SCHEDULER_FLUSHER_INTENT); } | AlarmReceiver extends BroadcastReceiver { Intent supplyIntent() { return new Intent(SCHEDULER_FLUSHER_INTENT); } } | AlarmReceiver extends BroadcastReceiver { Intent supplyIntent() { return new Intent(SCHEDULER_FLUSHER_INTENT); } AlarmReceiver(@NonNull SchedulerCallback callback); } | AlarmReceiver extends BroadcastReceiver { Intent supplyIntent() { return new Intent(SCHEDULER_FLUSHER_INTENT); } AlarmReceiver(@NonNull SchedulerCallback callback); @Override void onReceive(Context context, Intent intent); } | AlarmReceiver extends BroadcastReceiver { Intent supplyIntent() { return new Intent(SCHEDULER_FLUSHER_INTENT); } AlarmReceiver(@NonNull SchedulerCallback callback); @Override void onReceive(Context context, Intent intent); } |
@Test public void checksPushIfTelemetryEnabled() throws Exception { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); EventsQueue mockedEventsQueue = mock(EventsQueue.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedEventsQueue, TelemetryEnabler.State.ENABLED); ... | public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String us... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String us... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String us... |
@Test public void checksPushIfTelemetryDisabled() throws Exception { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); EventsQueue mockedEventsQueue = mock(EventsQueue.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedEventsQueue, TelemetryEnabler.State.DISABLED)... | public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String us... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String us... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean push(Event event) { if (sendEventIfWhitelisted(event)) { return true; } return pushToQueue(event); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String us... |
@Test(expected = NullPointerException.class) public void getLastLocationNullCallback() { engine.getLastLocation(null); } | @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.create(bestLastLocation)); } else { callback.onFailure(new Exception... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location bestLastLocation = getBestLastLocation(); if (bestLastLocation != null) { callback.onSuccess(LocationEngineResult.cr... |
@Test public void checksFlusherRegisteringWhenEnabled() throws Exception { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); SchedulerFlusher mockedSchedulerFlusher = mock(SchedulerFlusher.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedSchedulerFlusher); theMa... | public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... |
@Test public void checksFlusherSchedulingWhenEnabled() throws Exception { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); SchedulerFlusher mockedSchedulerFlusher = mock(SchedulerFlusher.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedSchedulerFlusher); theMap... | public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean enable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { startTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... |
@Test public void checksFlushEnqueuedEventsWhenDisabled() throws Exception { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); EventsQueue mockedEventsQueue = mock(EventsQueue.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedEventsQueue); theMapboxTelemetry.disa... | public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... |
@Test public void checksFlusherUnregisteringWhenDisabled() throws Exception { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); SchedulerFlusher mockedSchedulerFlusher = mock(SchedulerFlusher.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedSchedulerFlusher); th... | public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean disable() { if (TelemetryEnabler.isEventsEnabled(applicationContext)) { stopTelemetry(); return true; } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String acc... |
@Test public void checksAccessTokenUpdated() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); String anotherValidAccessToken = "anotherValidAccessToken"; boolean updatedAccessToken = theMapboxTe... | public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... |
@Test public void checksAccessTokenNotUpdatedWhenAccessTokenNull() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); String nullAccessToken = null; boolean updatedAccessToken = theMapboxTelemetry... | public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... |
@Test public void checksAccessTokenNotUpdatedWhenAccessTokenEmpty() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); String emptyAccessToken = ""; boolean updatedAccessToken = theMapboxTelemetry... | public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... |
@Test public void checksAccessTokenNotUpdatedWhenTelemetryClientNull() throws Exception { TelemetryClient nullTelemetryClient = null; MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(nullTelemetryClient); String anotherValidAccessToken = "anotherValidAccessToken"; boolean updatedAccessToken = theMapboxTel... | public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean updateAccessToken(String accessToken) { if (isAccessTokenValid(accessToken) && updateTelemetryClient(accessToken)) { sAccessToken.set(accessToken); return true; } return false; } MapboxTelemetry(Context context, String accessToken, Strin... |
@Test public void checkAddTelemetryListener() throws Exception { MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetry(); TelemetryListener telemetryListener = mock(TelemetryListener.class); assertTrue(theMapboxTelemetry.addTelemetryListener(telemetryListener)); } | public boolean addTelemetryListener(TelemetryListener listener) { return telemetryListeners.add(listener); } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addTelemetryListener(TelemetryListener listener) { return telemetryListeners.add(listener); } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addTelemetryListener(TelemetryListener listener) { return telemetryListeners.add(listener); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String userAgent... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addTelemetryListener(TelemetryListener listener) { return telemetryListeners.add(listener); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String userAgent... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addTelemetryListener(TelemetryListener listener) { return telemetryListeners.add(listener); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String userAgent... |
@Test public void checkAddAttachmentListener() throws Exception { MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetry(); AttachmentListener attachmentListener = mock(AttachmentListener.class); assertTrue(theMapboxTelemetry.addAttachmentListener(attachmentListener)); } | public boolean addAttachmentListener(AttachmentListener listener) { return attachmentListeners.add(listener); } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addAttachmentListener(AttachmentListener listener) { return attachmentListeners.add(listener); } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addAttachmentListener(AttachmentListener listener) { return attachmentListeners.add(listener); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String userAg... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addAttachmentListener(AttachmentListener listener) { return attachmentListeners.add(listener); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String userAg... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean addAttachmentListener(AttachmentListener listener) { return attachmentListeners.add(listener); } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context, String accessToken, String userAg... |
@Test(expected = NullPointerException.class) public void requestLocationUpdatesNullCallback() { engine.requestLocationUpdates(null, null, null); } | @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) ... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... | MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener... |
@Test public void checksSetBaseUrlWithValidHostAndWithConnection() throws Exception { Context mockedContext = obtainNetworkConnectedMockedContext(); TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); Callback mockedHttpCallback = mock(Callback.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxT... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
@Test public void checksSetBaseUrlWithValidHostAndWithoutConnection() throws Exception { Context mockedContext = obtainNetworkNotConnectedMockedContext(); TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); Callback mockedHttpCallback = mock(Callback.class); MapboxTelemetry theMapboxTelemetry = obtainM... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
@Test public void checksSetBaseUrlWithNullHost() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); assertFalse(theMapboxTelemetry.setBaseUrl(null)); verify(mockedTelemetryClient, never()).setBase... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
@Test public void checksSetBaseUrlWithEmptyHost() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); assertFalse(theMapboxTelemetry.setBaseUrl("")); verify(mockedTelemetryClient, never()).setBaseU... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
@Test public void checksSetBaseUrlWithInvalidHostOne() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); assertFalse(theMapboxTelemetry.setBaseUrl("h@st.com")); verify(mockedTelemetryClient, neve... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
@Test public void checksSetBaseUrlWithInvalidHostTwo() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); assertFalse(theMapboxTelemetry.setBaseUrl("new host.com")); verify(mockedTelemetryClient, ... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
@Test public void checksSetBaseUrlWithInvalidHostThree() throws Exception { TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedTelemetryClient); assertFalse(theMapboxTelemetry.setBaseUrl("host..com")); verify(mockedTelemetryClient, n... | @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } } | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... | MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @SuppressWarnings("WeakerAccess") @Deprecated public synchronized boolean setBaseUrl(String eventsHost) { if (isValidUrl(eventsHost) && checkNetworkAndParameters()) { telemetryClient.setBaseUrl(eventsHost); return true; } return false; } MapboxTelemetr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.