Search in sources :

Example 1 with MaxNumberFieldValue

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

the class MessageValidatorShould method provide_one_valid_violation_if_number_is_greater_than_max.

@Test
public void provide_one_valid_violation_if_number_is_greater_than_max() {
    final MaxNumberFieldValue msg = MaxNumberFieldValue.newBuilder().setValue(GREATER_THAN_MAX).build();
    validate(msg);
    assertEquals(1, violations.size());
    final ConstraintViolation violation = firstViolation();
    assertEquals(GREATER_MAX_MSG, format(violation.getMsgFormat(), violation.getParam(0)));
    assertFieldPathIs(violation, VALUE);
    assertTrue(violation.getViolationList().isEmpty());
}
Also used : MaxNumberFieldValue(io.spine.test.validate.msg.MaxNumberFieldValue) ConstraintViolation(io.spine.validate.ConstraintViolation) Test(org.junit.Test)

Example 2 with MaxNumberFieldValue

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

the class MessageValidatorShould method find_out_that_number_is_less_than_max_inclusive.

@Test
public void find_out_that_number_is_less_than_max_inclusive() {
    final MaxNumberFieldValue msg = MaxNumberFieldValue.newBuilder().setValue(LESS_THAN_MAX).build();
    validate(msg);
    assertIsValid(true);
}
Also used : MaxNumberFieldValue(io.spine.test.validate.msg.MaxNumberFieldValue) Test(org.junit.Test)

Example 3 with MaxNumberFieldValue

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

the class MessageValidatorShould method find_out_that_number_is_equal_to_max_inclusive.

@Test
public void find_out_that_number_is_equal_to_max_inclusive() {
    final MaxNumberFieldValue msg = MaxNumberFieldValue.newBuilder().setValue(EQUAL_MAX).build();
    validate(msg);
    assertIsValid(true);
}
Also used : MaxNumberFieldValue(io.spine.test.validate.msg.MaxNumberFieldValue) Test(org.junit.Test)

Example 4 with MaxNumberFieldValue

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

the class MessageValidatorShould method find_out_that_number_is_greater_than_max_inclusive.

/*
     * Max option tests.
     */
@Test
public void find_out_that_number_is_greater_than_max_inclusive() {
    final MaxNumberFieldValue msg = MaxNumberFieldValue.newBuilder().setValue(GREATER_THAN_MAX).build();
    validate(msg);
    assertIsValid(false);
}
Also used : MaxNumberFieldValue(io.spine.test.validate.msg.MaxNumberFieldValue) Test(org.junit.Test)

Aggregations

MaxNumberFieldValue (io.spine.test.validate.msg.MaxNumberFieldValue)4 Test (org.junit.Test)4 ConstraintViolation (io.spine.validate.ConstraintViolation)1