### Question:
LocationValidator { public boolean isValidUpdate(@NonNull Location location) { return checkLastValidLocation(location) || location.getAccuracy() < accuracyThreshold; } LocationValidator(int accuracyThreshold); boolean isValidUpdate(@NonNull Location location);  }### Answer:
@Test public void isValidUpdate_trueOnFirstUpdate() { Location location = buildLocationWithAccuracy(10); int accuracyThreshold = 100; LocationValidator validator = new LocationValidator(accuracyThreshold); boolean isValid = validator.isValidUpdate(location); assertTrue(isValid); }
@Test public void isValidUpdate_trueWhenUnder100MeterAccuracyThreshold() { Location location = buildLocationWithAccuracy(90); LocationValidator validator = buildValidatorWithUpdate(); boolean isValid = validator.isValidUpdate(location); assertTrue(isValid); }
@Test public void isValidUpdate_falseWhenOver100MeterAccuracyThreshold() { Location location = buildLocationWithAccuracy(110); LocationValidator validator = buildValidatorWithUpdate(); boolean isValid = validator.isValidUpdate(location); assertFalse(isValid); }