added all the unit tests for the validation
Merge branch 'write-unit-tests'
refactored the validation methods