Persistence { public void putBoolean(String key, boolean value) { preferences.edit().putBoolean(key, value).apply(); } Persistence(); @Nullable DataMap getDataMap(String key); void putDataMap(String key, DataMap dataMap); String getString(String key, String defaultValue); void putString(String key, String value); boolean getBoolean(String key, boolean defaultValue); void putBoolean(String key, boolean value); long whenDataUpdated(); Set<String> getSetOf(String key); void addToSet(String key, String value); void removeFromSet(String key, String value); static void storeDataMap(String key, DataMap dataMap); static Set<String> setOf(String key); static final String COMPLICATION_PROVIDER_PREFERENCES_FILE_KEY; }
@Test public void putBooleanTest() { Persistence persistence = new Persistence(); final boolean emptyGot = persistence.getBoolean("test-key", false); persistence.putBoolean("test-key", true); final boolean updatedGot = persistence.getBoolean("test-key", false); assertFalse(emptyGot); assertTrue(updatedGot); }