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