.param(WebTestConstants.FORM_FIELD_EMAIL, EMAIL)
.param(WebTestConstants.FORM_FIELD_FIRST_NAME, FIRST_NAME)
.param(WebTestConstants.FORM_FIELD_LAST_NAME, LAST_NAME)
.param(WebTestConstants.FORM_FIELD_PASSWORD, PASSWORD)
.param(WebTestConstants.FORM_FIELD_PASSWORD_VERIFICATION, PASSWORD)
.sessionAttr(WebTestConstants.SESSION_ATTRIBUTE_USER_FORM, new RegistrationForm())
)
.andExpect(status().isOk())
.andExpect(view().name("user/registrationForm"))
.andExpect(forwardedUrl("/WEB-INF/jsp/user/registrationForm.jsp"))
.andExpect(model().attribute(WebTestConstants.MODEL_ATTRIBUTE_USER_FORM, allOf(
hasProperty(WebTestConstants.FORM_FIELD_EMAIL, is(EMAIL)),
hasProperty(WebTestConstants.FORM_FIELD_FIRST_NAME, is(FIRST_NAME)),
hasProperty(WebTestConstants.FORM_FIELD_LAST_NAME, is(LAST_NAME)),
hasProperty(WebTestConstants.FORM_FIELD_PASSWORD, is(PASSWORD)),
hasProperty(WebTestConstants.FORM_FIELD_PASSWORD, is(PASSWORD)),
hasProperty(WebTestConstants.FORM_FIELD_SIGN_IN_PROVIDER, isEmptyOrNullString())
)))
.andExpect(model().attributeHasFieldErrors(WebTestConstants.MODEL_ATTRIBUTE_USER_FORM, WebTestConstants.FORM_FIELD_EMAIL));
assertThat(SecurityContextHolder.getContext()).userIsAnonymous();
ArgumentCaptor<RegistrationForm> registrationFormArgument = ArgumentCaptor.forClass(RegistrationForm.class);
verify(userServiceMock, times(1)).registerNewUserAccount(registrationFormArgument.capture());
verifyNoMoreInteractions(userServiceMock);
RegistrationForm formObject = registrationFormArgument.getValue();
assertThatRegistrationForm(formObject)
.isNormalRegistration()
.hasEmail(EMAIL)
.hasFirstName(FIRST_NAME)
.hasLastName(LAST_NAME)