UserSettingsServiceImpl extends BaseServiceImpl<UserSettings> implements UserSettingsService { @Override public String getSettingByKey(String key) { return getSettingByKey(userInstance.get(), key); }  @Override UserSettings get(String id); @Override UserSettings getById(UUID id); @Override UserSettings getByUser(); @Override UserSettings getByUser(HawkularUser user); @Override UserSettings getOrCreateByUser(); @Override UserSettings getOrCreateByUser(HawkularUser user); @Override String getSettingByKey(String key); @Override String getSettingByKey(String key, String defaultValue); @Override String getSettingByKey(HawkularUser user, String key); @Override String getSettingByKey(HawkularUser user, String key, String defaultValue); @Override UserSettings store(HawkularUser user, String key, String value); @Override UserSettings store(String key, String value); @Override UserSettings remove(HawkularUser user, String key); @Override UserSettings remove(String key); @Override @Produces @NamedSetting String produceSettingByName(InjectionPoint injectionPoint);  }
@Test public void returnsDefaultValueIfNoneExists() { HawkularUser user = userService.getOrCreateById(UUID.randomUUID().toString()); String value = settingsService.getSettingByKey(user, "hawkular.settings.foo", "bar"); assertEquals("Value returned should be 'bar'.", "bar", value); }