Search in sources :

Example 1 with TimeInFutureFieldValue

use of io.spine.test.validate.msg.TimeInFutureFieldValue in project core-java by SpineEventEngine.

the class MessageValidatorShould method find_out_that_time_is_in_future.

/*
     * Time option tests.
     */
@Test
public void find_out_that_time_is_in_future() {
    final TimeInFutureFieldValue validMsg = TimeInFutureFieldValue.newBuilder().setValue(getFuture()).build();
    validate(validMsg);
    assertIsValid(true);
}
Also used : TimeInFutureFieldValue(io.spine.test.validate.msg.TimeInFutureFieldValue) Test(org.junit.Test)

Example 2 with TimeInFutureFieldValue

use of io.spine.test.validate.msg.TimeInFutureFieldValue in project core-java by SpineEventEngine.

the class MessageValidatorShould method find_out_that_time_is_NOT_in_future.

@Test
public void find_out_that_time_is_NOT_in_future() {
    final TimeInFutureFieldValue invalidMsg = TimeInFutureFieldValue.newBuilder().setValue(getPast()).build();
    validate(invalidMsg);
    assertIsValid(false);
}
Also used : TimeInFutureFieldValue(io.spine.test.validate.msg.TimeInFutureFieldValue) Test(org.junit.Test)

Example 3 with TimeInFutureFieldValue

use of io.spine.test.validate.msg.TimeInFutureFieldValue in project core-java by SpineEventEngine.

the class MessageValidatorShould method provide_one_valid_violation_if_time_is_invalid.

@Test
public void provide_one_valid_violation_if_time_is_invalid() {
    final TimeInFutureFieldValue invalidMsg = TimeInFutureFieldValue.newBuilder().setValue(getPast()).build();
    validate(invalidMsg);
    assertEquals(1, violations.size());
    final ConstraintViolation violation = firstViolation();
    assertEquals("Timestamp value must be in the future.", format(firstViolation().getMsgFormat(), firstViolation().getParam(0)));
    assertFieldPathIs(violation, VALUE);
    assertTrue(violation.getViolationList().isEmpty());
}
Also used : ConstraintViolation(io.spine.validate.ConstraintViolation) TimeInFutureFieldValue(io.spine.test.validate.msg.TimeInFutureFieldValue) Test(org.junit.Test)

Aggregations

TimeInFutureFieldValue (io.spine.test.validate.msg.TimeInFutureFieldValue)3 Test (org.junit.Test)3 ConstraintViolation (io.spine.validate.ConstraintViolation)1