vertx/src/test/java/eu/internetofus/common/vertx/RepositoryTest.java
/**
   * Verify that the not obtain the sort object with bad values.
   *
   * @param param with the values to convert.
   *
   * @see Repository#queryParamToSort(Iterable, String,Function)
   */
Verify that the not obtain the sort object with bad values.
@param param with the values to convert.


Verify that the not obtain the sort object with bad values . @param param with the values to convert .
@ParameterizedTest(name = "Should {0} can not converted to sort")
  @ValueSource(strings = { ",key;[0]", "key, ;[1]", "key1,-key2,+key3, ;[3]", "+key1,-key1;[1]", "+key1,-KeY1;[1]",
      "key1,key2,value3;[2]" })
  public void shouldSortThrowException(final String param) {
    final var endIndex = param.indexOf(';');
    final var values = param.substring(0, endIndex).split(",");
    final var expected = param.substring(endIndex + 1).trim();
    final var error = catchThrowableOfType(
        () -> Repository.queryParamToSort(Arrays.asList(values), "codePrefix", (value) -> {
          final var key = value.toLowerCase();
          if (!key.startsWith("key")) {
            return null;
          } else {
            return key;
          }
        }), ValidationErrorException.class);
    assertThat(error).isNotNull();
    assertThat(error.getCode()).isEqualTo("codePrefix" + expected);
  }
@ ParameterizedTest ( name = "Should {0} can not converted to sort" ) @ ValueSource ( strings = { ",key;[0]" , "key, ;[1]" , "key1,-key2,+key3, ;[3]" , "+key1,-key1;[1]" , "+key1,-KeY1;[1]" , "key1,key2,value3;[2]" } ) public void shouldSortThrowException ( final String param ) { final var endIndex = param . indexOf ( ';' ) ; final var values = param . substring ( 0 , endIndex ) . split ( "," ) ; final var expected = param . substring ( endIndex + 1 ) . trim ( ) ; final var error = catchThrowableOfType ( ( ) -> Repository . queryParamToSort ( Arrays . asList ( values ) , "codePrefix" , ( value ) -> { final var key = value . toLowerCase ( ) ; if ( ! key . startsWith ( "key" ) ) { return null ; } else { return key ; } } ) , ValidationErrorException . class ) ; assertThat ( error ) . isNotNull ( ) ; assertThat ( error . getCode ( ) ) . isEqualTo ( "codePrefix" + expected ) ; }
Verify that the not obtain the sort object with bad values.
Verify that the not obtain the sort object with bad values .