components/src/test/java/eu/internetofus/common/components/task_manager/TaskTransactionPredicates.java
/**
   * Return a predicate the check that the transaction contains the specified
   * messages.
   *
   * @param checkMessages predicated to match at least one message.
   *
   * @return the predicate to check exist at least one message that satisfy the
   *         predicate.
   */
Return a predicate the check that the transaction contains the specified
messages.

@param checkMessages predicated to match at least one message.

@return the predicate to check exist at least one message that satisfy the
predicate.
Return a predicate the check that the transaction contains the specified messages . @param checkMessages predicated to match at least one message . @return the predicate to check exist at least one message that satisfy the predicate .
static Predicate<TaskTransaction> containsMessages(final List<Predicate<Message>> checkMessages) {
    return target -> {
      if (target.messages != null && target.messages.size() >= checkMessages.size()) {
        final var copy = new ArrayList<>(checkMessages);
        for (final var msg : target.messages) {
          final var iter = copy.iterator();
          while (iter.hasNext()) {
            final var predicate = iter.next();
            if (predicate.test(msg)) {
              iter.remove();
              break;
            }
          }
        }
        return copy.isEmpty();
      } else {
        return false;
      }
    };
  }
static Predicate < TaskTransaction > containsMessages ( final List < Predicate < Message > > checkMessages ) { return target -> { if ( target . messages != null && target . messages . size ( ) >= checkMessages . size ( ) ) { final var copy = new ArrayList < > ( checkMessages ) ; for ( final var msg : target . messages ) { final var iter = copy . iterator ( ) ; while ( iter . hasNext ( ) ) { final var predicate = iter . next ( ) ; if ( predicate . test ( msg ) ) { iter . remove ( ) ; break ; } } } return copy . isEmpty ( ) ; } else { return false ; } } ; }
Return a predicate the check that the transaction contains the specified
 messages.
Return a predicate the check that the transaction contains the specified messages .