### Question:
EnumPreference extends AbsPreference<E> { @SuppressWarnings("unchecked") @Override public E get() { if (getPreferences().contains(getKey())) { return (E) enumValues[getPreferences().getInt(getKey(), 0)]; } else { return getDefaultValue(); } } EnumPreference(SharedPreferences preferences, String key, E defaultValue); @SuppressWarnings("unchecked") @Override E get(); @Override void set(E value);  }### Answer:
@Test public void getValue() { TestEnum expected = TEST2; String key = "testKey2"; preferences.edit().putInt(key, expected.ordinal()).commit(); EnumPreference<TestEnum> preference = new EnumPreference<TestEnum>(preferences, key, TEST3); TestEnum result = preference.get(); assertThat(result).isEqualTo(expected); }