|
Whenever you pass a property path like list[0].foo to Validator#validateProperty, an exception is thrown:
(The actual message and error code differs between 4.3 and 5.1, but the issue is the same. With HV 4.1, it does work.)
If you pass the same property path to Validator#validateValue (like in the existing unit tests), it works fine. The unit test for Validator#validateValue has been created as part of
HV-596
. However, I suspect the issue was introduced with
HV-395
.
I have a attached an enhanced version of the latest ValidatorTest where following two tests fail with mentioned exception:
@Test
@TestForIssue(jiraKey = "HV-xyz")
public void testValidatePropertyWithNestedPath() {
Validator validator = getValidator();
X someX = new X();
someX.addZ( new Z() );
Set<ConstraintViolation<X>> constraintViolations = validator.validateProperty( someX, "list[0].foo" );
assertNumberOfViolations( constraintViolations, 1 );
assertCorrectPropertyPaths( constraintViolations, "list[0].foo" );
}
@Test
@TestForIssue(jiraKey = "HV-xyz")
public void testValidatePropertyWithNestedSetPath() {
Validator validator = getValidator();
XX someObject = new XX();
someObject.addZ( new Z() );
Set<ConstraintViolation<XX>> constraintViolations = validator.validateProperty( someObject, "set[0].foo" );
assertNumberOfViolations( constraintViolations, 1 );
assertCorrectPropertyPaths( constraintViolations, "set[0].foo" );
}
|