### Question:
FusedLocationProviderServiceDelegate implements LocationEngine.Callback { @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) public LocationAvailability getLocationAvailability() { return locationEngine.createLocationAvailability(); } FusedLocationProviderServiceDelegate(Context context); void add(IFusedLocationProviderCallback callback); void remove(IFusedLocationProviderCallback callback); Location getLastLocation(); @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) LocationAvailability getLocationAvailability(); void requestLocationUpdates(LocationRequest request); void removeLocationUpdates(List<LocationRequest> requests); void setMockMode(boolean isMockMode); void setMockLocation(Location mockLocation); void setMockTrace(String path, String filename); @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) void reportLocation(Location location); @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) void reportProviderDisabled(String provider); @RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION}) void reportProviderEnabled(String provider);  }### Answer:
@Test public void getLocationAvailability_gps_network_shouldBeAvailable() { shadowLocationManager.setProviderEnabled(GPS_PROVIDER, true); shadowLocationManager.setProviderEnabled(NETWORK_PROVIDER, true); Location location = new Location("test"); shadowLocationManager.setLastKnownLocation(GPS_PROVIDER, location); LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isTrue(); }
@Test public void getLocationAvailability_gps_network_shouldBeUnavailable() { shadowLocationManager.setProviderEnabled(GPS_PROVIDER, true); shadowLocationManager.setProviderEnabled(NETWORK_PROVIDER, true); LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isFalse(); }
@Test public void getLocationAvailability_gps_shouldBeAvailable() { shadowLocationManager.setProviderEnabled(GPS_PROVIDER, true); Location location = new Location("test"); shadowLocationManager.setLastKnownLocation(GPS_PROVIDER, location); LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isTrue(); }
@Test public void getLocationAvailability_gps_shouldBeUnavailable() { shadowLocationManager.setProviderEnabled(GPS_PROVIDER, true); LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isFalse(); }
@Test public void getLocationAvailability_network_shouldBeAvailable() { shadowLocationManager.setProviderEnabled(NETWORK_PROVIDER, true); Location location = new Location("test"); shadowLocationManager.setLastKnownLocation(NETWORK_PROVIDER, location); LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isTrue(); }
@Test public void getLocationAvailability_network_shouldBeUnavailable() { shadowLocationManager.setProviderEnabled(NETWORK_PROVIDER, true); LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isFalse(); }
@Test public void getLocationAvailability_shouldBeUnavailable() { LocationAvailability availability = delegate.getLocationAvailability(); assertThat(availability.isLocationAvailable()).isFalse(); }