marcinadd / projecty-web

Project management software based on spring
GNU General Public License v3.0
74 stars 74 forks source link

ISSUE-51: added message validator #55

Closed shourav9884 closed 4 years ago

marcinadd commented 4 years ago

Thanks for your contribution :) You don't have to create your own annotations. This project uses spring so your MessageValidator should implement org.springframework.validation.Validator. Then you use (@)Valid annotation. Check how UserValidator works and make MessageSimilar similar to it. You should also provide some tests for your code.

shourav9884 commented 4 years ago

@marcinadd thank you so much for reviewing. I have updated code according to your comment.

marcinadd commented 4 years ago

Ok. Thanks. Now it looks much better in my opinion. You added integration tests to MessageController, but you can also add Unit tests which test only MessageValidator. See UserValidatorTests class for example. Don't forget to fix possible NullPointerException which I reviewed above.

shourav9884 commented 4 years ago

Ok. I will update my tests. About the NullpointerException case as I replied your comment above, I think it will not happen because it is checked already

marcinadd commented 4 years ago

Yes, you're right. As a curiosity, I will give an example that in your code (and in my WIP code too) there is a chance that MessageValidator can allow you to send a message to yourself :)

shourav9884 commented 4 years ago

@marcinadd added some test case and fixed the equal checking for user by overriding the equals method. please check

marcinadd commented 4 years ago

Your code will be merged tomorrow. Thanks

marcinadd commented 4 years ago

You have created a lot of commits. To keep my branch clean I squash merged it. Your commit messages are in the description. Thanks for your contribution