BasePreference { public boolean isSet() { return sharedPreferences.contains(key); } BasePreference(@NonNull SharedPreferences sharedPreferences, @NonNull String key,
      @Nullable T defaultValue, boolean commit); boolean isSet(); @SuppressLint("CommitPrefEdits") void set(@Nullable T value); @SuppressLint("CommitPrefEdits") void delete(); abstract T get();  }
@Test public void shouldNotBeSetInitially() { BooleanPreference booleanPreference = BooleanPreference.newInstance(sharedPreferences, "key", true); assertThat(booleanPreference.isSet()).isFalse(); }