Code example for LocationManager

Methods: getBestProvider

0
  } 
 
  @Test 
  public void shouldReturnNullIfBestProviderNotExplicitlySet() throws Exception { 
    Criteria criteria = new Criteria();
    assertNull(locationManager.getBestProvider(null, false));
    assertNull(locationManager.getBestProvider(null, true));
    assertNull(locationManager.getBestProvider(criteria, false));
    assertNull(locationManager.getBestProvider(criteria, true));
  } 
 
  @Test 
  public void shouldThrowExceptionWhenRequestingLocationUpdatesWithANullIntent() throws Exception { 
    try { 
      shadowLocationManager.requestLocationUpdates(0, 0, new Criteria(), null);
      Assert.fail("When requesting location updates the intent must not be null!");
    } catch (Exception e) {
      // No worries, everything is fine... 
    } 
  }