model/src/test/java/eu/internetofus/common/model/ValidateContextTest.java
/**
   * Should fail validate enum field.
   *
   * @param testContext test context to use.
   *
   * @see ValidateContext#validateEnumField(String, Object, Promise, Object...)
   */
Should fail validate enum field.
@param testContext test context to use.


Should fail validate enum field . @param testContext test context to use .
@Test
  public void shouldFailValidateEnumField(final VertxTestContext testContext) {
    doReturn("codePrefixEnum").when(this.context).errorCode();
    final Promise<Void> promise = Promise.promise();
    this.context.validateEnumField("enumField", 3, promise, 0, 1, 2);
    testContext.assertFailure(promise.future()).onFailure(error -> {
      testContext.verify(() -> {
        assertThat(error).isInstanceOf(ValidationErrorException.class);
        final var cause = (ValidationErrorException) error;
        assertThat(cause.getCode()).isEqualTo("codePrefixEnum.enumField");
        assertThat(cause.getMessage()).contains("[0, 1, 2]");
      });
      testContext.completeNow();
    });
  }
@ Test public void shouldFailValidateEnumField ( final VertxTestContext testContext ) { doReturn ( "codePrefixEnum" ) . when ( this . context ) . errorCode ( ) ; final Promise < Void > promise = Promise . promise ( ) ; this . context . validateEnumField ( "enumField" , 3 , promise , 0 , 1 , 2 ) ; testContext . assertFailure ( promise . future ( ) ) . onFailure ( error -> { testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ValidationErrorException . class ) ; final var cause = ( ValidationErrorException ) error ; assertThat ( cause . getCode ( ) ) . isEqualTo ( "codePrefixEnum.enumField" ) ; assertThat ( cause . getMessage ( ) ) . contains ( "[0, 1, 2]" ) ; } ) ; testContext . completeNow ( ) ; } ) ; }
Should fail validate enum field.
Should fail validate enum field .