@Test
public void testRequestLocationUpdatesTC2() throws Exception {

    // when backgroundLocationUpdates is enabled and fetch mode is current location
    when(LocationServices.getFusedLocationProviderClient(application))
            .thenReturn(providerClient);
    when(Utils.isConcurrentFuturesDependencyAvailable())
            .thenReturn(true);
    GoogleLocationAdapter locationAdapter = new GoogleLocationAdapter(application);
    CTGeofenceSettings ctGeofenceSettings = new CTGeofenceSettings.Builder()
            .setLocationFetchMode(CTGeofenceSettings.FETCH_CURRENT_LOCATION_PERIODIC)
            .enableBackgroundLocationUpdates(true).build();
    when(ctGeofenceAPI.getGeofenceSettings()).thenReturn(ctGeofenceSettings);
    // enqueue work to verify later that work is cancelled by method under test
    WorkManager workManager = WorkManager.getInstance(application);
    PeriodicWorkRequest locationRequest = new PeriodicWorkRequest.Builder(BackgroundLocationWork.class,
            1800000, TimeUnit.MILLISECONDS,
            600000, TimeUnit.MILLISECONDS)
            .build();
    workManager.enqueueUniquePeriodicWork(TAG_WORK_LOCATION_UPDATES,
            ExistingPeriodicWorkPolicy.KEEP, locationRequest).getResult().get();
    // call method under test
    locationAdapter.requestLocationUpdates();
    // Get WorkInfo and outputData
    WorkInfo workInfo = workManager.getWorkInfoById(locationRequest.getId()).get();
    // Assert work is cancelled by locationAdapter.requestLocationUpdates()
    assertThat(workInfo.getState(), is(WorkInfo.State.CANCELLED));
    verify(providerClient).requestLocationUpdates(
            any(LocationRequest.class), any(PendingIntent.class));
    verifyStatic(Tasks.class);
    Tasks.await(null);
}