@SuppressLint("CommitPrefEdits") @Test public void shouldCommitSetOperation() { String newValue = "new_value"; StringPreference stringPreference = StringPreference.newInstance(mockSharedPreferences, "key", "default_value", true); stringPreference.set(newValue); verify(mockEditor).putString("key", newValue); verify(mockEditor).commit(); }
public static StringPreference newInstance(@NonNull SharedPreferences preferences, @NonNull String key, @Nullable String defaultValue) { return newInstance(preferences, key, defaultValue, false); }
StringPreference extends BasePreference<String> { public static StringPreference newInstance(@NonNull SharedPreferences preferences, @NonNull String key, @Nullable String defaultValue) { return newInstance(preferences, key, defaultValue, false); } }
StringPreference extends BasePreference<String> { public static StringPreference newInstance(@NonNull SharedPreferences preferences, @NonNull String key, @Nullable String defaultValue) { return newInstance(preferences, key, defaultValue, false); } StringPreference(@NonNull SharedPreferences sharedPreferences, @NonNull String key,
      @Nullable String defaultValue, boolean commit); }
StringPreference extends BasePreference<String> { public static StringPreference newInstance(@NonNull SharedPreferences preferences, @NonNull String key, @Nullable String defaultValue) { return newInstance(preferences, key, defaultValue, false); } StringPreference(@NonNull SharedPreferences sharedPreferences, @NonNull String key,
      @Nullable String defaultValue, boolean commit); static StringPreference newInstance(@NonNull SharedPreferences preferences,
      @NonNull String key, @Nullable String defaultValue); static StringPreference newInstance(@NonNull SharedPreferences preferences,
      @NonNull String key, @Nullable String defaultValue, boolean commit); @Nullable String get(); }
StringPreference extends BasePreference<String> { public static StringPreference newInstance(@NonNull SharedPreferences preferences, @NonNull String key, @Nullable String defaultValue) { return newInstance(preferences, key, defaultValue, false); } StringPreference(@NonNull SharedPreferences sharedPreferences, @NonNull String key,
      @Nullable String defaultValue, boolean commit); static StringPreference newInstance(@NonNull SharedPreferences preferences,
      @NonNull String key, @Nullable String defaultValue); static StringPreference newInstance(@NonNull SharedPreferences preferences,
      @NonNull String key, @Nullable String defaultValue, boolean commit); @Nullable String get();  }