Code example for Criteria

Methods: setAccuracy, setPowerRequirement

0
    assertThat("BEST_ENABLED_PROVIDER_WITH_CRITERIA").isEqualTo(locationManager.getBestProvider(criteria, true));
  } 
 
  @Test 
  public void shouldReturnBestProviderUsingCriteria() { 
    Criteria criteria = new Criteria();
 
    shadowLocationManager.setProviderEnabled(LocationManager.GPS_PROVIDER, false);
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    assertThat(LocationManager.GPS_PROVIDER).isEqualTo(locationManager.getBestProvider(criteria, false));
 
    shadowLocationManager.setProviderEnabled(LocationManager.NETWORK_PROVIDER, false);
    criteria.setAccuracy(Criteria.ACCURACY_COARSE);
    assertThat(LocationManager.NETWORK_PROVIDER).isEqualTo(locationManager.getBestProvider(criteria, false));
 
    criteria.setPowerRequirement(Criteria.POWER_LOW);
    criteria.setAccuracy(Criteria.ACCURACY_FINE);
    assertThat(LocationManager.NETWORK_PROVIDER).isEqualTo(locationManager.getBestProvider(criteria, false));
  } 
 
  @Test 
  public void shouldReturnBestDisabledProvider() throws Exception {