protocols/src/test/java/eu/internetofus/common/protocols/AbstractProtocolITC.java
/**
   * Wait until has received the specified callbacks.
   *
   * @param vertx         event bus to use.
   * @param testContext   context to do the test.
   * @param checkMessages the functions that has all to be {@code true} to stop
   *                      waiting.
   *
   * @return the messages that satisfy the predicates.
   */
Wait until has received the specified callbacks.
@param vertx         event bus to use.
@param testContext   context to do the test.
@param checkMessages the functions that has all to be  true to stop
waiting.

@return the messages that satisfy the predicates.
Wait until has received the specified callbacks . @param vertx event bus to use . @param testContext context to do the test . @param checkMessages the functions that has all to be true to stop waiting . @return the messages that satisfy the predicates .
protected Future<List<Message>> waitUntilCallbacks(@NotNull final Vertx vertx,
      @NotNull final VertxTestContext testContext, @NotNull final List<Predicate<Message>> checkMessages) {
    return this.waitUntil(vertx, testContext, () -> Model
        .fromFutureJsonArray(WeNetServiceSimulator.createProxy(vertx).retrieveCallbacks(this.app.appId), Message.class),
        callbacks -> {
          final List<Predicate<Message>> copy = new ArrayList<>(checkMessages);
          final var callbacksIter = callbacks.iterator();
          while (callbacksIter.hasNext()) {
            final var msg = callbacksIter.next();
            if (msg != null) {
              final var iter = copy.iterator();
              while (iter.hasNext()) {
                final var checkMessage = iter.next();
                if (checkMessage.test(msg)) {
                  iter.remove();
                  break;
                }
              }
            }
            callbacksIter.remove();
          }
          return copy.isEmpty();
        }).compose(callbacks -> WeNetServiceSimulator.createProxy(vertx).deleteCallbacks(this.app.appId)
            .map(empty -> callbacks));
  }
protected Future < List < Message > > waitUntilCallbacks ( @ NotNull final Vertx vertx , @ NotNull final VertxTestContext testContext , @ NotNull final List < Predicate < Message > > checkMessages ) { return this . waitUntil ( vertx , testContext , ( ) -> Model . fromFutureJsonArray ( WeNetServiceSimulator . createProxy ( vertx ) . retrieveCallbacks ( this . app . appId ) , Message . class ) , callbacks -> { final List < Predicate < Message > > copy = new ArrayList < > ( checkMessages ) ; final var callbacksIter = callbacks . iterator ( ) ; while ( callbacksIter . hasNext ( ) ) { final var msg = callbacksIter . next ( ) ; if ( msg != null ) { final var iter = copy . iterator ( ) ; while ( iter . hasNext ( ) ) { final var checkMessage = iter . next ( ) ; if ( checkMessage . test ( msg ) ) { iter . remove ( ) ; break ; } } } callbacksIter . remove ( ) ; } return copy . isEmpty ( ) ; } ) . compose ( callbacks -> WeNetServiceSimulator . createProxy ( vertx ) . deleteCallbacks ( this . app . appId ) . map ( empty -> callbacks ) ) ; }
Wait until has received the specified callbacks.
Wait until has received the specified callbacks .