add unit test for validator