.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_SIGN_IN_PROVIDER, SIGN_IN_PROVIDER.name())
.sessionAttr(ProviderSignInAttempt.SESSION_ATTRIBUTE, socialSignIn)
.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, isEmptyOrNullString()),
hasProperty(WebTestConstants.FORM_FIELD_PASSWORD, isEmptyOrNullString()),
hasProperty(WebTestConstants.FORM_FIELD_SIGN_IN_PROVIDER, is(SIGN_IN_PROVIDER))
)))
.andExpect(model().attributeHasFieldErrors(WebTestConstants.MODEL_ATTRIBUTE_USER_FORM, WebTestConstants.FORM_FIELD_EMAIL));
assertThat(SecurityContextHolder.getContext()).userIsAnonymous();
assertThatSignIn(socialSignIn).createdNoConnections();
ArgumentCaptor<RegistrationForm> registrationFormArgument = ArgumentCaptor.forClass(RegistrationForm.class);
verify(userServiceMock, times(1)).registerNewUserAccount(registrationFormArgument.capture());
verifyNoMoreInteractions(userServiceMock);
RegistrationForm formObject = registrationFormArgument.getValue();
assertThatRegistrationForm(formObject)
.isSocialSignInWithSignInProvider(SIGN_IN_PROVIDER)
.hasEmail(EMAIL)
.hasFirstName(FIRST_NAME)
.hasLastName(LAST_NAME)