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


Should create a fail future with a cause . @param testContext test context to use .
@Test
  public void shouldFailWithCause(final VertxTestContext testContext) {
    doReturn("codeCause").when(this.context).errorCode();
    final var cause = new Throwable("cause");
    final var future = this.context.fail(cause);
    testContext.assertFailure(future).onFailure(error -> {
      testContext.verify(() -> {
        assertThat(error).isInstanceOf(ValidationErrorException.class);
        final var failedCause = (ValidationErrorException) error;
        assertThat(failedCause.getCode()).isEqualTo("codeCause");
        assertThat(failedCause.getMessage()).contains(cause.getMessage());
        assertThat(failedCause.getCause()).isEqualTo(cause);
      });
      testContext.completeNow();
    });
  }
@ Test public void shouldFailWithCause ( final VertxTestContext testContext ) { doReturn ( "codeCause" ) . when ( this . context ) . errorCode ( ) ; final var cause = new Throwable ( "cause" ) ; final var future = this . context . fail ( cause ) ; testContext . assertFailure ( future ) . onFailure ( error -> { testContext . verify ( ( ) -> { assertThat ( error ) . isInstanceOf ( ValidationErrorException . class ) ; final var failedCause = ( ValidationErrorException ) error ; assertThat ( failedCause . getCode ( ) ) . isEqualTo ( "codeCause" ) ; assertThat ( failedCause . getMessage ( ) ) . contains ( cause . getMessage ( ) ) ; assertThat ( failedCause . getCause ( ) ) . isEqualTo ( cause ) ; } ) ; testContext . completeNow ( ) ; } ) ; }
Should create a fail future with a cause.
Should create a fail future with a cause .