use of io.spine.base.FieldPath in project core-java by SpineEventEngine.
the class AbstractValidatingBuilder method validate.
@Override
public <V> void validate(FieldDescriptor descriptor, V fieldValue, String fieldName) throws ConstraintViolationThrowable {
final FieldPath fieldPath = FieldPath.newBuilder().addFieldName(fieldName).build();
final FieldValidator<?> validator = FieldValidatorFactory.create(descriptor, fieldValue, fieldPath);
final List<ConstraintViolation> violations = validator.validate();
onViolations(violations);
}
use of io.spine.base.FieldPath in project core-java by SpineEventEngine.
the class MessageValidatorShould method assertFieldPathIs.
private static void assertFieldPathIs(ConstraintViolation violation, String... expectedFields) {
final FieldPath path = violation.getFieldPath();
final ProtocolStringList actualFields = path.getFieldNameList();
assertEquals(expectedFields.length, actualFields.size());
assertEquals(copyOf(expectedFields), copyOf(actualFields));
}
Aggregations