model/src/test/java/eu/internetofus/common/model/ValidateContextTest.java
/**
   * Should create a fail future with a message and a code.
   *
   * @param testContext test context to use.
   *
   * @see ValidateContext#fail(String,String)
   */
Should create a fail future with a message and a code.
@param testContext test context to use.


Should create a fail future with a message and a code . @param testContext test context to use .
@Test
  public void shouldFailWithCodeAndMessage(final VertxTestContext testContext) {
    final var future = this.context.fail("codePrefix2", "message2");
    testContext.assertFailure(future).onFailure(error -> {
      testContext.verify(() -> {
        assertThat(error).isInstanceOf(ValidationErrorException.class);
        final var cause = (ValidationErrorException) error;
        assertThat(cause.getCode()).isEqualTo("codePrefix2");
        assertThat(cause.getMessage()).isEqualTo("message2");
      });
      testContext.completeNow();
    });
  }
@ Test public void shouldFailWithCodeAndMessage ( final VertxTestContext testContext ) { final var future = this . context . fail ( "codePrefix2" , "message2" ) ; testContext . assertFailure ( future ) . onFailure ( error -> { testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ValidationErrorException . class ) ; final var cause = ( ValidationErrorException ) error ; assertThat ( cause . getCode ( ) ) . isEqualTo ( "codePrefix2" ) ; assertThat ( cause . getMessage ( ) ) . isEqualTo ( "message2" ) ; } ) ; testContext . completeNow ( ) ; } ) ; }
Should create a fail future with a message and a code.
Should create a fail future with a message and a code .