vertx/src/test/java/eu/internetofus/common/vertx/QueryBuilderTest.java
/**
   * Should create query with iterable regex and values.
   *
   * @see QueryBuilder#withEqOrRegex(String, Iterable)
   */
Should create query with iterable regex and values.
Should create query with iterable regex and values .
@Test
  public void shouldCreateQueryWithIterableRegexValue() {
    final var builder = new QueryBuilder();
    assertThat(builder.withEqOrRegex("fieldName", Arrays.asList("value", null, "/key.+/"))).isSameAs(builder);
    assertThat(builder.build()).isEqualTo(new JsonObject().put("fieldName",
        new JsonObject().put("$all",
            new JsonArray().add(new JsonObject().put("$elemMatch", new JsonObject().put("$eq", "value"))).add(
                new JsonObject().put("$elemMatch", new JsonObject().put("$regex", "key.+").put("$options", "i"))))));
  }
@ Test public void shouldCreateQueryWithIterableRegexValue ( ) { final var builder = new QueryBuilder ( ) ; assertThat ( builder . withEqOrRegex ( "fieldName" , Arrays . asList ( "value" , null , "/key.+/" ) ) ) . isSameAs ( builder ) ; assertThat ( builder . build ( ) ) . isEqualTo ( new JsonObject ( ) . put ( "fieldName" , new JsonObject ( ) . put ( "$all" , new JsonArray ( ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "$eq" , "value" ) ) ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "$regex" , "key.+" ) . put ( "$options" , "i" ) ) ) ) ) ) ; }
Should create query with iterable regex and values.
Should create query with iterable regex and values .