@Test public void saveValue() { TestEnum expected = TEST2; String key = "testKey"; EnumPreference<TestEnum> preference = new EnumPreference<TestEnum>(preferences, key, TEST1); preference.set(expected); assertThat(TestEnum.values()[preferences.getInt(key, 0)]).isEqualTo(expected); }
@Override public void set(E value) { if (value == null) throw new NullPointerException("value"); this.set(value.ordinal()); }
EnumPreference extends AbsPreference<E> { @Override public void set(E value) { if (value == null) throw new NullPointerException("value"); this.set(value.ordinal()); } }
EnumPreference extends AbsPreference<E> { @Override public void set(E value) { if (value == null) throw new NullPointerException("value"); this.set(value.ordinal()); } EnumPreference(SharedPreferences preferences, String key, E defaultValue); }
EnumPreference extends AbsPreference<E> { @Override public void set(E value) { if (value == null) throw new NullPointerException("value"); this.set(value.ordinal()); } EnumPreference(SharedPreferences preferences, String key, E defaultValue); @SuppressWarnings("unchecked") @Override E get(); @Override void set(E value); }
EnumPreference extends AbsPreference<E> { @Override public void set(E value) { if (value == null) throw new NullPointerException("value"); this.set(value.ordinal()); } EnumPreference(SharedPreferences preferences, String key, E defaultValue); @SuppressWarnings("unchecked") @Override E get(); @Override void set(E value);  }