AudibleSettings { public void load(@NonNull SharedPreferences prefs) { final String audibleMode = prefs.getString("audible_mode", "horizontal_speed"); mode = AudibleModes.get(audibleMode); min = Numbers.parseDouble(prefs.getString("audible_min", Float.toString(mode.defaultMin))); max = Numbers.parseDouble(prefs.getString("audible_max", Float.toString(mode.defaultMax))); precision = Numbers.parseInt(prefs.getString("audible_precision", Integer.toString(mode.defaultPrecision)), mode.defaultPrecision); speechInterval = Numbers.parseFloat(prefs.getString("audible_interval", "2.5")); speechRate = Numbers.parseFloat(prefs.getString("audible_rate", "1.0")); isEnabled = prefs.getBoolean("audible_enabled", false); airplaneMode = prefs.getBoolean("audible_quiet", true); }  void load(@NonNull SharedPreferences prefs); void setAudibleMode(@NonNull String audibleMode); public boolean isEnabled; public boolean airplaneMode; @NonNull
    public AudibleMode mode; public double min; public double max; public int precision; public float speechInterval; public float speechRate; }
@Test public void loadSettings() { AudibleSettings settings = new AudibleSettings(); settings.load(new SharedPreferencesMock()); assertFalse(settings.isEnabled); assertTrue(settings.airplaneMode); assertEquals("Horizontal Speed", settings.mode.name); assertEquals(0.0, settings.min, 0.001); assertEquals(80.467, settings.max, 0.001); assertEquals(0, settings.precision); assertEquals(2.5, settings.speechInterval, 0.001); assertEquals(1.0, settings.speechRate, 0.001); }