@Test public void awaitTimeout_shouldTimeoutAfterInterval() { 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); DelayTestPendingIntentGenerator delayedGenerator = new DelayTestPendingIntentGenerator(context); LocationSettingsResultRequest settingsResultRequest = new LocationSettingsResultRequest(context, delayedGenerator, request); LocationSettingsResult resultRequest = settingsResultRequest.await(1000, TimeUnit.MILLISECONDS); assertThat(resultRequest.getStatus().getStatusCode()).isEqualTo(Status.TIMEOUT); }
@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);  }