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

@param source attributes to be similar.

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