use of io.spine.test.validate.msg.EnclosedMessageFieldValue in project core-java by SpineEventEngine.
the class MessageValidatorShould method provide_valid_violations_if_enclosed_message_field_is_not_valid.
@Test
public void provide_valid_violations_if_enclosed_message_field_is_not_valid() {
final RequiredStringFieldValue enclosedMsg = RequiredStringFieldValue.getDefaultInstance();
final EnclosedMessageFieldValue msg = EnclosedMessageFieldValue.newBuilder().setOuterMsgField(enclosedMsg).build();
validate(msg);
assertEquals(1, violations.size());
final ConstraintViolation violation = firstViolation();
assertEquals("Message must have valid properties.", violation.getMsgFormat());
assertFieldPathIs(violation, OUTER_MSG_FIELD);
final List<ConstraintViolation> innerViolations = violation.getViolationList();
assertEquals(1, innerViolations.size());
final ConstraintViolation innerViolation = innerViolations.get(0);
assertEquals(NO_VALUE_MSG, innerViolation.getMsgFormat());
assertFieldPathIs(innerViolation, OUTER_MSG_FIELD, VALUE);
assertTrue(innerViolation.getViolationList().isEmpty());
}
use of io.spine.test.validate.msg.EnclosedMessageFieldValue in project core-java by SpineEventEngine.
the class MessageValidatorShould method find_out_that_enclosed_message_field_is_valid.
/*
* Enclosed message field validation option tests.
*/
@Test
public void find_out_that_enclosed_message_field_is_valid() {
final RequiredStringFieldValue enclosedMsg = RequiredStringFieldValue.newBuilder().setValue(newUuid()).build();
final EnclosedMessageFieldValue msg = EnclosedMessageFieldValue.newBuilder().setOuterMsgField(enclosedMsg).build();
validate(msg);
assertIsValid(true);
}
use of io.spine.test.validate.msg.EnclosedMessageFieldValue in project core-java by SpineEventEngine.
the class MessageValidatorShould method find_out_that_enclosed_message_field_is_NOT_valid.
@Test
public void find_out_that_enclosed_message_field_is_NOT_valid() {
final RequiredStringFieldValue enclosedMsg = RequiredStringFieldValue.getDefaultInstance();
final EnclosedMessageFieldValue msg = EnclosedMessageFieldValue.newBuilder().setOuterMsgField(enclosedMsg).build();
validate(msg);
assertIsValid(false);
}
Aggregations