Code example for List

Methods: contains, size

0
    assertTrue(providers.contains(GPS_PROVIDER));
    assertThat(providers.size()).isEqualTo(2);
 
    shadowLocationManager.setProviderEnabled(LocationManager.PASSIVE_PROVIDER, true);
    providers = locationManager.getProviders(true);
    assertTrue(providers.contains(NETWORK_PROVIDER));
    assertTrue(providers.contains(GPS_PROVIDER));
    assertTrue(providers.contains(LocationManager.PASSIVE_PROVIDER));
    assertThat(providers.size()).isEqualTo(3);
  } 
 
  @Test 
  public void shouldReturnAllProviders() throws Exception { 
    assertThat(locationManager.getAllProviders().size()).isEqualTo(3);
 
    shadowLocationManager.setProviderEnabled("MY_PROVIDER", false);
    assertThat(locationManager.getAllProviders().size()).isEqualTo(4);
  } 
 
  @Test 
  public void shouldReturnLastKnownLocationForAProvider() throws Exception {