PreferenceStoreImpl implements PreferenceStore { @Override public <T> T get(final PreferenceScope scope, final String key) { return storage.read(scope, key); } protected  PreferenceStoreImpl();   PreferenceStoreImpl(final PreferenceStorage storage,
                        final PreferenceScopeFactory scopeFactory,
                        final PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy); @Inject  PreferenceStoreImpl(final PreferenceStorage storage,
                               final PreferenceScopeFactory scopeFactory,
                               @Customizable final PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy,
                               final Instance<PreferenceScopeResolutionStrategy> preferenceScopeResolutionStrategy,
                               final InjectionPoint ip); @Override PreferenceScopeResolutionStrategyInfo getDefaultScopeResolutionStrategyInfo(); @Override PreferenceScopeResolver getDefaultScopeResolver(); @Override void put(final PreferenceScope scope,
                        final String key,
                        final T value); @Override void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                        final String key,
                        final T value); @Override void put(final String key,
                        final T value); @Override void put(final PreferenceScope scope,
                        final Map<String, T> valueByKey); @Override void put(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                        final Map<String, T> valueByKey); @Override void put(final Map<String, T> valueByKey); @Override void putIfAbsent(final PreferenceScope scope,
                                final String key,
                                final T value); @Override void putIfAbsent(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                final String key,
                                final T value); @Override void putIfAbsent(final String key,
                                final T value); @Override void putIfAbsent(final PreferenceScope scope,
                                final Map<String, T> valueByKey); @Override void putIfAbsent(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                final Map<String, T> valueByKey); @Override void putIfAbsent(final Map<String, T> valueByKey); @Override T get(final PreferenceScope scope,
                     final String key); @Override T get(final PreferenceScope scope,
                     final String key,
                     final T defaultValue); @Override T get(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                     final String key); @Override T get(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                     final String key,
                     final T defaultValue); @Override T get(final String key); @Override T get(final String key,
                     final T defaultValue); @Override PreferenceScopedValue<T> getScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                                  final String key); @Override PreferenceScopedValue<T> getScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                                  final String key,
                                                  final T defaultValue); @Override PreferenceScopedValue<T> getScoped(final String key); @Override PreferenceScopedValue<T> getScoped(final String key,
                                                  final T defaultValue); @Override Map<String, Object> search(final PreferenceScope scope,
                                      final Collection<String> keys); @Override Map<String, Object> search(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                      final Collection<String> keys); @Override Map<String, Object> search(final Collection<String> keys); @Override Map<String, PreferenceScopedValue<Object>> searchScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,
                                                                   final Collection<String> keys); @Override Map<String, PreferenceScopedValue<Object>> searchScoped(final Collection<String> keys); @Override Map<String, Object> all(final PreferenceScope scope); @Override Map<String, Object> all(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo); @Override Map<String, Object> all(); @Override Map<String, PreferenceScopedValue<Object>> allScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo); @Override Map<String, PreferenceScopedValue<Object>> allScoped(); @Override void remove(final PreferenceScope scope,
                       final String key); @Override void remove(final List<PreferenceScope> scopes,
                       final String key);  }
@Test public void getStringValueFromScopeWithoutDefaultValueTest() { mockStorageRead(VALUE); final String value = preferenceStore.get(allUsersEntireApplication, KEY); assertEquals(VALUE, value); verify(storage).read(allUsersEntireApplication, KEY); }
@Test public void getNullValueFromScopeWithoutDefaultValueTest() { final String value = preferenceStore.get(allUsersEntireApplication, KEY); assertNull(value); verify(storage).read(allUsersEntireApplication, KEY); }
@Test public void getStringValueFromScopeWithDefaultValueTest() { mockStorageRead(VALUE); final String value = preferenceStore.get(allUsersEntireApplication, KEY, DEFAULT_VALUE); assertEquals(VALUE, value); verify(storage).read(allUsersEntireApplication, KEY); }
@Test public void getNullValueFromScopeWithDefaultValueTest() { final String value = preferenceStore.get(allUsersEntireApplication, KEY, DEFAULT_VALUE); assertEquals(DEFAULT_VALUE, value); verify(storage).read(allUsersEntireApplication, KEY); }
@Test public void getStringValueFromScopeResolutionStrategyWithoutDefaultValueTest() { mockStorageRead(VALUE); final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo, KEY); assertEquals(VALUE, value); verify(storage).read(preferenceScopeResolutionStrategyInfo, KEY); }
@Test public void getNullValueFromScopeResolutionStrategyWithoutDefaultValueTest() { final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo, KEY); assertNull(value); verify(storage).read(preferenceScopeResolutionStrategyInfo, KEY); }
@Test public void getStringValueFromScopeResolutionStrategyWithDefaultValueTest() { mockStorageRead(VALUE); final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo, KEY, DEFAULT_VALUE); assertEquals(VALUE, value); verify(storage).read(preferenceScopeResolutionStrategyInfo, KEY); }
@Test public void getNullValueFromScopeResolutionStrategyWithDefaultValueTest() { final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo, KEY, DEFAULT_VALUE); assertEquals(DEFAULT_VALUE, value); verify(storage).read(preferenceScopeResolutionStrategyInfo, KEY); }
@Test public void getStringValueWithoutDefaultValueTest() { mockStorageRead(VALUE); final String value = preferenceStore.get(KEY); assertEquals(VALUE, value); }
@Test public void getNullValueWithoutDefaultValueTest() { final String value = preferenceStore.get(KEY); assertNull(value); verify(storage).read(allUsersEntireApplication, KEY); }