AuditConfig { @Nullable public LocationClient.Priority getLocationPriority() { return locationPriority; } AuditConfig(String mode, String locationMinInterval, String locationMaxAge, boolean isTrackingChangesEnabled, boolean isIdentifyUserEnabled, boolean isTrackChangesReasonEnabled); @Nullable LocationClient.Priority getLocationPriority(); @Nullable Long getLocationMinInterval(); @Nullable Long getLocationMaxAge(); boolean isLocationEnabled(); boolean isTrackingChangesEnabled(); boolean isIdentifyUserEnabled(); boolean isTrackChangesReasonEnabled();  }
@Test public void testPriorities() { AuditConfig auditConfig = new AuditConfig.Builder().setMode("high_accuracy").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_HIGH_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("high-accuracy").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_HIGH_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("HIGH_ACCURACY").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_HIGH_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("balanced").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_BALANCED_POWER_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("BALANCED").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_BALANCED_POWER_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("low_power").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_LOW_POWER, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("low-power").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_LOW_POWER, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("low_POWER").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_LOW_POWER, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("no_power").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_NO_POWER, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("no-power").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_NO_POWER, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("NO_power").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_NO_POWER, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("qwerty").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_HIGH_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode("").setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertEquals(PRIORITY_HIGH_ACCURACY, auditConfig.getLocationPriority()); auditConfig = new AuditConfig.Builder().setMode(null).setLocationMinInterval(null).setLocationMaxAge(null).setIsTrackingChangesEnabled(false).setIsIdentifyUserEnabled(false).setIsTrackChangesReasonEnabled(false).createAuditConfig(); assertNull(auditConfig.getLocationPriority()); }