### Question:
FloatPreference extends AbsPreference<Float> { @Override public Float get() { return getPreferences().getFloat(getKey(), getDefaultValue()); } FloatPreference(SharedPreferences preferences, String key);  FloatPreference(SharedPreferences preferences, String key, float defaultValue); @Override Float get(); @Override void set(Float value); @SuppressLint("CommitPrefEdits") void set(float value);  }### Answer:
@Test public void getValue() { float expected = 2f; String key = "testKey2"; preferences.edit().putFloat(key, expected).commit(); FloatPreference preference = new FloatPreference(preferences, key); float result = preference.get(); assertThat(result).isEqualTo(expected); }