Search in sources :

Example 1 with UserSettingsService

use of org.opencastproject.adminui.usersettings.UserSettingsService in project opencast by opencast.

the class TestUserSettingsEndpoint method setupUserSettingsService.

private void setupUserSettingsService() throws UserSettingsServiceException {
    int start = 1;
    int finish = 10;
    int limit = 100;
    int offset = 0;
    int total = 10;
    UserSettings userSettings = createUserSettings(start, finish, limit, offset, total);
    userSettingsService = EasyMock.createNiceMock(UserSettingsService.class);
    EasyMock.expect(userSettingsService.findUserSettings(limit, 0)).andReturn(userSettings);
    final Capture<String> inputKey = new Capture<String>();
    final Capture<String> inputValue = new Capture<String>();
    EasyMock.expect(userSettingsService.addUserSetting(EasyMock.capture(inputKey), EasyMock.capture(inputValue))).andAnswer(new IAnswer<UserSetting>() {

        public UserSetting answer() {
            UserSetting userSetting = new UserSetting(19, inputKey.getValue(), inputValue.getValue());
            return userSetting;
        }
    });
    userSettingsService.deleteUserSetting(18L);
    EasyMock.expectLastCall();
    EasyMock.expect(userSettingsService.updateUserSetting(18, EXAMPLE_KEY, EXAMPLE_VALUE)).andReturn(new UserSetting(18L, EXAMPLE_KEY, EXAMPLE_VALUE));
    EasyMock.replay(userSettingsService);
}
Also used : UserSettings(org.opencastproject.adminui.usersettings.UserSettings) UserSettingsService(org.opencastproject.adminui.usersettings.UserSettingsService) Capture(org.easymock.Capture) UserSetting(org.opencastproject.adminui.usersettings.UserSetting)

Aggregations

Capture (org.easymock.Capture)1 UserSetting (org.opencastproject.adminui.usersettings.UserSetting)1 UserSettings (org.opencastproject.adminui.usersettings.UserSettings)1 UserSettingsService (org.opencastproject.adminui.usersettings.UserSettingsService)1