public Preference<Boolean> getBoolean(@StringRes int prefKey, @BoolRes int defaultValue) {
    return mRxSharedPreferences.getBoolean(
        mResources.getString(prefKey), mResources.getBoolean(defaultValue));
  }
@Test
  public void testBooleanHappyPath() {
    RxSharedPrefs impl = new RxSharedPrefs(getApplicationContext(), this::testRestoreFunction);

    final Preference<Boolean> preference =
        impl.getBoolean(R.string.pref_test_key, R.bool.pref_test_value);
    Assert.assertTrue(preference.get());

    final AtomicReference<Boolean> observedValue = new AtomicReference<>(null);
    mCompositeDisposable.add(preference.asObservable().subscribe(observedValue::set));

    Assert.assertTrue(observedValue.get());

    SharedPrefsHelper.setPrefsValue(R.string.pref_test_key, false);

    Assert.assertFalse(preference.get());
    Assert.assertFalse(observedValue.get());
  }