protocols/src/test/java/eu/internetofus/common/protocols/Ask4HelpV2_2ProtocolWithAllFiltersITC.java
/**
   * Check that a state attribute is equals to the expected.
   *
   * @param state         to check.
   * @param attributeName name of the attribute to compare.
   * @param ordered       is {@code true} if the order is important.
   *
   * @return {@code true} if the expected attribute is equals.
   */
Check that a state attribute is equals to the expected.
@param state         to check.
@param attributeName name of the attribute to compare.
@param ordered       is  true if the order is important.

@return  true if the expected attribute is equals.
Check that a state attribute is equals to the expected . @param state to check . @param attributeName name of the attribute to compare . @param ordered is true if the order is important . @return true if the expected attribute is equals .
private boolean assertExpectedTaskStateAttribute(final State state, final String attributeName,
      final boolean ordered) {
    final var value = state.attributes.getJsonArray(attributeName);
    final var expected = this.expectedState.getJsonArray(attributeName);
    if (value == null || expected.size() != value.size()) {
      return false;
    } else if (!ordered) {
      final var copy = new JsonArray(expected.toString());
      final var max = copy.size();
      for (var i = 0; i < max; i++) {
        final var element = value.getValue(i);
        for (var j = 0; j < copy.size(); j++) {
          final var expectedElement = copy.getValue(j);
          if (this.compareUserValues(expectedElement, element)) {
            copy.remove(j);
            break;
          }
        }
      }
      return copy.isEmpty();
    } else {
      final var max = expected.size();
      for (var i = 0; i < max; i++) {
        final var element = value.getValue(i);
        final var expectedElement = expected.getValue(i);
        if (!this.compareUserValues(expectedElement, element)) {
          return false;
        }
      }
      return true;
    }
  }
private boolean assertExpectedTaskStateAttribute ( final State state , final String attributeName , final boolean ordered ) { final var value = state . attributes . getJsonArray ( attributeName ) ; final var expected = this . expectedState . getJsonArray ( attributeName ) ; if ( value == null || expected . size ( ) != value . size ( ) ) { return false ; } else if ( ! ordered ) { final var copy = new JsonArray ( expected . toString ( ) ) ; final var max = copy . size ( ) ; for ( var i = 0 ; i < max ; i ++ ) { final var element = value . getValue ( i ) ; for ( var j = 0 ; j < copy . size ( ) ; j ++ ) { final var expectedElement = copy . getValue ( j ) ; if ( this . compareUserValues ( expectedElement , element ) ) { copy . remove ( j ) ; break ; } } } return copy . isEmpty ( ) ; } else { final var max = expected . size ( ) ; for ( var i = 0 ; i < max ; i ++ ) { final var element = value . getValue ( i ) ; final var expectedElement = expected . getValue ( i ) ; if ( ! this . compareUserValues ( expectedElement , element ) ) { return false ; } } return true ; } }
Check that a state attribute is equals to the expected.
Check that a state attribute is equals to the expected .