@Test public void testGetUserSettings() throws Exception { final List<IUserSetting> settings = userSettingService.getUserSettings(); assertNotNull(settings); assertEquals(3, settings.size()); for (IUserSetting setting : settings) { if (COMMON_SETTING_NAME.equals(setting.getSettingName())) { assertEquals(COMMON_USER_SETTING_VALUE, setting.getSettingValue()); } else if (USER_SETTING_NAME_3.equals(setting.getSettingName())) { assertEquals(USER_SETTING_VALUE_3, setting.getSettingValue()); } else if (GLOBAL_SETTING_NAME_3.equals(setting.getSettingName())) { assertEquals(GLOBAL_SETTING_VALUE_3, setting.getSettingValue()); } } }
@Test public void testGetUserSettingsByName() throws Exception { final List<IUserSetting> settings = userSettingService.getUserSettings("test"); IAuthorizationPolicy policy = mock(IAuthorizationPolicy.class); when(policy.isAllowed(anyString())).thenReturn(true); PentahoSystem.registerObject(policy); assertNotNull(settings); assertEquals(2, settings.size()); for (IUserSetting setting : settings) { if (COMMON_SETTING_NAME.equals(setting.getSettingName())) { assertEquals(COMMON_USER_SETTING_VALUE, setting.getSettingValue()); } else if (USER_SETTING_NAME_3.equals(setting.getSettingName())) { assertEquals(USER_SETTING_VALUE_3, setting.getSettingValue()); } else if (GLOBAL_SETTING_NAME_3.equals(setting.getSettingName())) { assertEquals(GLOBAL_SETTING_VALUE_3, setting.getSettingValue()); } } }