AuditConfig { public boolean isLocationEnabled() { return locationPriority != null && locationMinInterval != null && locationMaxAge != null; } AuditConfig(String mode, String locationMinInterval, String locationMaxAge, boolean isTrackingChangesEnabled); @Nullable LocationClient.Priority getLocationPriority(); @Nullable Long getLocationMinInterval(); @Nullable Long getLocationMaxAge(); boolean isLocationEnabled(); boolean isTrackingChangesEnabled();  }
@Test public void logLocationCoordinatesOnlyIfAllParametersAreSet() { AuditConfig auditConfig = new AuditConfig("high-accuracy", "10", "60", false); assertTrue(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig(null, "10", "60", false); assertFalse(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig(null, null, "60", false); assertFalse(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig(null, null, null, false); assertFalse(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig("balanced", null, null, false); assertFalse(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig("balanced", "10", null, false); assertFalse(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig("balanced", null, "60", false); assertFalse(auditConfig.isLocationEnabled()); auditConfig = new AuditConfig(null, null, "60", false); assertFalse(auditConfig.isLocationEnabled()); }