Pass the invalid value to addViolation and added some tests