@Test public void await_balancedLowPower_noBle_shouldReturnStatusSuccess() { when(pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)).thenReturn(true); when(pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK)).thenReturn(true); when(pm.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)).thenReturn(true); when(locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)).thenReturn(true); ArrayList<LocationRequest> requests = new ArrayList<>(); LocationRequest balanced = LocationRequest.create(new TestPidReader()).setPriority( LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY); LocationRequest lowPower = LocationRequest.create(new TestPidReader()).setPriority(LocationRequest.PRIORITY_LOW_POWER); requests.add(balanced); requests.add(lowPower); LocationSettingsRequest settingsRequest = new LocationSettingsRequest.Builder().addAllLocationRequests(requests) .setNeedBle(false) .build(); LocationSettingsResultRequest settingsResultRequest = new LocationSettingsResultRequest(context, generator, settingsRequest); LocationSettingsResult result = settingsResultRequest.await(); assertThat(result.getStatus().getStatusCode()).isEqualTo(Status.SUCCESS); }
@NonNull @Override public LocationSettingsResult await() { return generateLocationSettingsResult(); }
LocationSettingsResultRequest extends PendingResult<LocationSettingsResult> { @NonNull @Override public LocationSettingsResult await() { return generateLocationSettingsResult(); } }
LocationSettingsResultRequest extends PendingResult<LocationSettingsResult> { @NonNull @Override public LocationSettingsResult await() { return generateLocationSettingsResult(); } LocationSettingsResultRequest(Context context, PendingIntentGenerator generator,
      LocationSettingsRequest request); }
LocationSettingsResultRequest extends PendingResult<LocationSettingsResult> { @NonNull @Override public LocationSettingsResult await() { return generateLocationSettingsResult(); } LocationSettingsResultRequest(Context context, PendingIntentGenerator generator,
      LocationSettingsRequest request); @NonNull @Override LocationSettingsResult await(); @NonNull @Override LocationSettingsResult await(long time, @NonNull TimeUnit timeUnit); @Override void cancel(); @Override boolean isCanceled(); @Override void setResultCallback(@NonNull ResultCallback<? super LocationSettingsResult> callback); @Override void setResultCallback(@NonNull ResultCallback<? super LocationSettingsResult> callback,
      long time, @NonNull TimeUnit timeUnit); }
LocationSettingsResultRequest extends PendingResult<LocationSettingsResult> { @NonNull @Override public LocationSettingsResult await() { return generateLocationSettingsResult(); } LocationSettingsResultRequest(Context context, PendingIntentGenerator generator,
      LocationSettingsRequest request); @NonNull @Override LocationSettingsResult await(); @NonNull @Override LocationSettingsResult await(long time, @NonNull TimeUnit timeUnit); @Override void cancel(); @Override boolean isCanceled(); @Override void setResultCallback(@NonNull ResultCallback<? super LocationSettingsResult> callback); @Override void setResultCallback(@NonNull ResultCallback<? super LocationSettingsResult> callback,
      long time, @NonNull TimeUnit timeUnit);  }