Improved the unit test on validation with required keys