Package org.apache.rave.portal.web.model

Examples of org.apache.rave.portal.web.model.UserForm


        assertNotNull(errors.getFieldError(FIELD_PASSWORD));
    }

    @Test
    public void testValidationFailsOnNonMatchingPassword() throws Exception {
        UserForm user = new UserForm();
        user.setUsername(VALID_NAME);
        user.setPassword(VALID_PASSWORD);
        user.setConfirmPassword("doesnotmatch");
        user.setDefaultPageLayoutCode(VALID_PAGELAYOUT);
        user.setEmail(VALID_EMAIL);
        Errors errors = new BindException(user, NEW_USER);
        expect(mockUserService.getUserByUsername(VALID_NAME)).andReturn(null);
        expect(mockUserService.getUserByEmail(VALID_EMAIL)).andReturn(null);
        replay(mockUserService);
View Full Code Here


    authUser.setFamilyName("Rave");
    authUser.setAboutMe("Test User");
    authUser.setEmail("testuser@rave.com");

    //creating a mock updated user
    final UserForm updatedUser = new UserForm();
    //set the updated status
    updatedUser.setStatus("Married");
    updatedUser.setGivenName("Test");
    updatedUser.setFamilyName("Rave");
    updatedUser.setAboutMe("Test User");
    updatedUser.setEmail("testuser@rave.com");

    expect(userService.getAuthenticatedUser()).andReturn(authUser).anyTimes();
    userService.updateUserProfile(authUser);
    replay(userService);

    String view = profileController.updateProfile(model, referringPageId, updatedUser);

    //assert that the model is not null
    assertThat(model, CoreMatchers.notNullValue());

    //assert that the model size is three
    assertThat(model.size(), CoreMatchers.equalTo(modelSize));

    //assert that the model does contain an attribute associated with the authenticated user
    assertThat(model.containsAttribute(userProfile), CoreMatchers.equalTo(true));

    //assert that the model does not contain authenticated user as null
    assertThat(model.get(userProfile), CoreMatchers.notNullValue());

    //assert that the status of user is updated
    assertEquals(updatedUser.getStatus(), authUser.getStatus());

        assertThat(view, is("redirect:/app/person/" + USERNAME));

    verify(userService);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.web.model.UserForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.