I have this class;
public class A {
@NotNull @Valid
private B field;
}
When I wish to test validation of this class, I do not want it to cascade, I only wish to test @NotNull
, and do not want it to cascade validation down to class B
due to @Valid
.
I have been using;
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<A>> validationResult = validator.validate(buildA());
But it cascades down to validation of B
, how can I stop validation cascading without modifying the bean? I wish to isolate the validation of class A