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