@Test
  public void shouldReturnNullLocationWhenACriteriaFailsAndNoBestExists() {
    addCriteria(failsCriteria);

    Location location = bestLocationDelegate.getBestLastKnownLocation();
    assertNull(location);
    assertNotSame(location, candidateLocation);
  }
  @Test
  public void shouldReturnCandidateLocationWhenAllCriteriaPass() {
    addCriteria(passesCriteria);

    mockAccurateLocation(locationManager);
    Location location = bestLocationDelegate.getBestLastKnownLocation();
    assertSame(location, candidateLocation);
  }
  @Test
  public void shouldReturnPreviousGoodLocationIfACriteriaFailsForCandidate() {
    LocationCriteria failsForCandidateCriteria = mock(LocationCriteria.class);

    mockLessAccurateLocation(locationManager);
    mockAccurateLocation(locationManager);

    addCriteria(failsForCandidateCriteria);

    when(failsForCandidateCriteria.passes(eq(previousLocation), any(Location.class)))
        .thenReturn(true);
    when(failsForCandidateCriteria.passes(candidateLocation, previousLocation)).thenReturn(false);

    Location bestLastKnownLocation = bestLocationDelegate.getBestLastKnownLocation();

    assertSame(previousLocation, bestLastKnownLocation);
  }