add validator and its tests