Skip to content

Conversation

@lekarto
Copy link

@lekarto lekarto commented Dec 20, 2016

No description provided.

if(result.hasErrors()) {
userDto.setPassword(notEncodedPassword);
if (wrongPasswordConfirmError(result)) {
removePasswords(registerUserDto);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removePasswordsFromForm?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think that it's correct to mix layers. TransactionalAuthenticator wouldn't know about form. Proposed method name just for programmer and can tangle.

}


private void removePasswords(final RegisterUserDto registerUserDto) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add JavaDocs explaining what this does and why it's needed.

Also, we don't have a habit to put final for local vars and parameters :)

registerUserDto.getUserDto().setPassword(null);
}

private BindingResult removeWrongPasswordConfirmError(BindingResult srcErrors) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JavaDocs for this too

@Test
public void userMustSetToNullPasswordAndPasswordConfirmFieldsWhenTheyAreDifferent() throws Exception {

Validator customValidator = new Validator() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't you use the usual validator that's used in prod code?

}

@Test
public void userMustSetToNullPasswordAndPasswordConfirmFieldsWhenTheyAreDifferent() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emptiesPassowordAndConfirmationFields_ifTheyDoNotMatch

Maybe let's add some javadocs here explaining why it behaves like this.

}

@Test
public void userMustRestorePasswordAndPasswordConfirmFieldsWhenTheyAreEquals() throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesNotEmptyPasswordAndConfirmationFields_ifTheyMatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants