Search in sources :

Example 1 with MinNumberFieldValue

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

the class MessageValidatorShould method find_out_that_number_is_less_than_min.

@Test
public void find_out_that_number_is_less_than_min() {
    final MinNumberFieldValue msg = MinNumberFieldValue.newBuilder().setValue(LESS_THAN_MIN).build();
    validate(msg);
    assertIsValid(false);
}
Also used : MinNumberFieldValue(io.spine.test.validate.msg.MinNumberFieldValue) Test(org.junit.Test)

Example 2 with MinNumberFieldValue

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

the class MessageValidatorShould method find_out_that_number_is_greater_than_min.

/*
     * Min option tests.
     */
@Test
public void find_out_that_number_is_greater_than_min() {
    final MinNumberFieldValue msg = MinNumberFieldValue.newBuilder().setValue(GREATER_THAN_MIN).build();
    validate(msg);
    assertIsValid(true);
}
Also used : MinNumberFieldValue(io.spine.test.validate.msg.MinNumberFieldValue) Test(org.junit.Test)

Example 3 with MinNumberFieldValue

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

the class MessageValidatorShould method provide_one_valid_violation_if_number_is_less_than_min.

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

Example 4 with MinNumberFieldValue

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

the class MessageValidatorShould method find_out_that_number_is_equal_to_min.

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

Aggregations

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