Refactoring Validator#validate method and updating tests