Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ae4aed5 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch
Browse files

Fix failing test in PrefsBackupHelperTest

Test: runtest --path ...
Change-Id: Ic061fdf12cb75debce05112c5b3f40b47c755c53
parent f45884dd
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -54,9 +55,20 @@ public class PrefsBackupHelperTest {
    public void setUp() {
        mDefaultPrefs = InstrumentationRegistry.getContext().getSharedPreferences("prefs1", 0);
        mBackupPrefs = InstrumentationRegistry.getContext().getSharedPreferences("prefs2", 0);
        clearSharedPrefs();
        mPrefsBackupHelper = new PrefsBackupHelper(mDefaultPrefs);
    }

    @After
    public void tearDown() {
        clearSharedPrefs();
    }

    private void clearSharedPrefs() {
        mDefaultPrefs.edit().clear().commit();
        mBackupPrefs.edit().clear().commit();
    }

    @Test
    public void testPrepareBackupFile_BackupLocalPreferences() {
        mDefaultPrefs.edit().putInt(LOCAL_PREFERENCE_1, 1).commit();