model/src/test/java/eu/internetofus/common/model/ValidableAsserts.java
/**
   * Assert that a model is valid.
   *
   * @param model       to validate.
   * @param context     with the loaded components.
   * @param testContext test context to use.
   * @param expected    function to check the validation result.
   * @param <T>         model to test.
   * @param <C>         type of context.
   */
Assert that a model is valid.
@param model       to validate.
@param context     with the loaded components.
@param testContext test context to use.
@param expected    function to check the validation result.
@param          model to test.
@param          type of context.
Assert that a model is valid . @param model to validate . @param context with the loaded components . @param testContext test context to use . @param expected function to check the validation result . @param model to test . @param type of context .
public static <C extends ValidateContext<C>, T extends Validable<C>> void assertIsValid(final T model,
      final C context, final VertxTestContext testContext, final Runnable expected) {
    model.validate(context).onComplete(validation -> testContext.verify(() -> {
      if (validation.failed()) {
        final var cause = validation.cause();
        testContext.failNow(cause);
      } else {
        if (expected != null) {
          expected.run();
        }
        testContext.completeNow();
      }
    }));
  }
public static < C extends ValidateContext < C > , T extends Validable < C > > void assertIsValid ( final T model , final C context , final VertxTestContext testContext , final Runnable expected ) { model . validate ( context ) . onComplete ( validation -> testContext . verify ( ( ) -> { if ( validation . failed ( ) ) { final var cause = validation . cause ( ) ; testContext . failNow ( cause ) ; } else { if ( expected != null ) { expected . run ( ) ; } testContext . completeNow ( ) ; } } ) ) ; }
Assert that a model is valid.
Assert that a model is valid .