model/src/test/java/eu/internetofus/common/model/ValidateContextTest.java
/**
   * Check that a range value is not valid because it is greater than the maximum.
   *
   * @param testContext test context to use.
   *
   * @see ValidateContext#validateNumberOnRangeField(String, Number, Number,
   *      Number, Promise)
   */
Check that a range value is not valid because it is greater than the maximum.
@param testContext test context to use.


Check that a range value is not valid because it is greater than the maximum . @param testContext test context to use .
@Test
  public void shouldFailValidateNumberOnRangeFieldGreaterThan(final VertxTestContext testContext) {
    final Promise<Void> promise = Promise.promise();
    doReturn("codePrefixRange").when(this.context).errorCode();
    this.context.validateNumberOnRangeField("range", 1, null, 0, promise);
    testContext.assertFailure(promise.future()).onFailure(error -> {
      testContext.verify(() -> {
        assertThat(error).isInstanceOf(ValidationErrorException.class);
        final var cause = (ValidationErrorException) error;
        assertThat(cause.getCode()).isEqualTo("codePrefixRange.range");
        assertThat(cause.getMessage()).contains("'0'", "'1'");
      });
      testContext.completeNow();
    });
  }
@ Test public void shouldFailValidateNumberOnRangeFieldGreaterThan ( final VertxTestContext testContext ) { final Promise < Void > promise = Promise . promise ( ) ; doReturn ( "codePrefixRange" ) . when ( this . context ) . errorCode ( ) ; this . context . validateNumberOnRangeField ( "range" , 1 , null , 0 , promise ) ; testContext . assertFailure ( promise . future ( ) ) . onFailure ( error -> { testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ValidationErrorException . class ) ; final var cause = ( ValidationErrorException ) error ; assertThat ( cause . getCode ( ) ) . isEqualTo ( "codePrefixRange.range" ) ; assertThat ( cause . getMessage ( ) ) . contains ( "'0'" , "'1'" ) ; } ) ; testContext . completeNow ( ) ; } ) ; }
Check that a range value is not valid because it is greater than the maximum.
Check that a range value is not valid because it is greater than the maximum .