model/src/test/java/eu/internetofus/common/model/ValidateContextTest.java
/**
   * Check that a timestamp value is not valid.
   *
   * @param value       to be valid.
   * @param testContext test context to use.
   *
   * @see ValidateContext#validateTimeStampField(String, Long, Promise)
   */
Check that a timestamp value is not valid.
@param value       to be valid.
@param testContext test context to use.


Check that a timestamp value is not valid . @param value to be valid . @param testContext test context to use .
@ParameterizedTest(name = "Should {0} not be valid")
  @NullSource
  @ValueSource(longs = { -1, -2, -1l, -200l, -43l })
  public void shouldFailValidateTimeStampField(final Long value, final VertxTestContext testContext) {
    final Promise<Void> promise = Promise.promise();
    doReturn("codePrefixTimestamp").when(this.context).errorCode();
    this.context.validateTimeStampField("timestamp", value, promise);
    testContext.assertFailure(promise.future()).onFailure(error -> {
      testContext.verify(() -> {
        assertThat(error).isInstanceOf(ValidationErrorException.class);
        final var cause = (ValidationErrorException) error;
        assertThat(cause.getCode()).isEqualTo("codePrefixTimestamp.timestamp");
        assertThat(cause.getMessage()).contains(String.valueOf(value));
      });
      testContext.completeNow();
    });
  }
@ ParameterizedTest ( name = "Should {0} not be valid" ) @ NullSource @ ValueSource ( longs = { - 1 , - 2 , - 1l , - 200l , - 43l } ) public void shouldFailValidateTimeStampField ( final Long value , final VertxTestContext testContext ) { final Promise < Void > promise = Promise . promise ( ) ; doReturn ( "codePrefixTimestamp" ) . when ( this . context ) . errorCode ( ) ; this . context . validateTimeStampField ( "timestamp" , value , promise ) ; testContext . assertFailure ( promise . future ( ) ) . onFailure ( error -> { testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ValidationErrorException . class ) ; final var cause = ( ValidationErrorException ) error ; assertThat ( cause . getCode ( ) ) . isEqualTo ( "codePrefixTimestamp.timestamp" ) ; assertThat ( cause . getMessage ( ) ) . contains ( String . valueOf ( value ) ) ; } ) ; testContext . completeNow ( ) ; } ) ; }
Check that a timestamp value is not valid.
Check that a timestamp value is not valid .