components/src/test/java/eu/internetofus/common/components/service/MessagePredicates.java
/**
   * Return a predicate the check that the message attributes are similar to a
   * source.
   *
   * @param source attributes to be similar.
   *
   * @return the predicate to check the message attributes.
   */
Return a predicate the check that the message attributes are similar to a
source.

@param source attributes to be similar.

@return the predicate to check the message attributes.
Return a predicate the check that the message attributes are similar to a source . @param source attributes to be similar . @return the predicate to check the message attributes .
static Predicate<Message> attributesSimilarTo(final JsonObject source) {
    return target -> {
      if (target.attributes == null) {
        return false;
      }
      for (final var key : source.fieldNames()) {
        final var value = source.getValue(key);
        final var targetValue = target.attributes.getValue(key);
        if (value != targetValue && (value == null || !value.equals(targetValue))) {
          return false;
        }
      }
      return true;
    };
  }
static Predicate < Message > attributesSimilarTo ( final JsonObject source ) { return target -> { if ( target . attributes == null ) { return false ; } for ( final var key : source . fieldNames ( ) ) { final var value = source . getValue ( key ) ; final var targetValue = target . attributes . getValue ( key ) ; if ( value != targetValue && ( value == null || ! value . equals ( targetValue ) ) ) { return false ; } } return true ; } ; }
Return a predicate the check that the message attributes are similar to a
 source.
Return a predicate the check that the message attributes are similar to a source .