Search in sources :

Example 1 with FieldPath

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);
}
Also used : FieldPath(io.spine.base.FieldPath)

Example 2 with FieldPath

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));
}
Also used : FieldPath(io.spine.base.FieldPath) ProtocolStringList(com.google.protobuf.ProtocolStringList)

Aggregations

FieldPath (io.spine.base.FieldPath)2 ProtocolStringList (com.google.protobuf.ProtocolStringList)1