vertx/src/test/java/eu/internetofus/common/vertx/QueryBuilderTest.java
/**
   * Should create query with iterable regex.
   *
   * @see QueryBuilder#withRegex(String, Iterable)
   */
Should create query with iterable regex.
Should create query with iterable regex .
@Test
  public void shouldCreateQueryWithRegexIterable() {
    final var builder = new QueryBuilder();
    assertThat(builder.withRegex("fieldName", Arrays.asList("key1", "key2", "key3"))).isSameAs(builder);
    assertThat(builder.build()).isEqualTo(new JsonObject().put("fieldName",
        new JsonObject().put("$all", new JsonArray()
            .add(new JsonObject().put("$elemMatch", new JsonObject().put("$regex", "key1").put("$options", "i")))
            .add(new JsonObject().put("$elemMatch", new JsonObject().put("$regex", "key2").put("$options", "i")))
            .add(new JsonObject().put("$elemMatch", new JsonObject().put("$regex", "key3").put("$options", "i"))))));
  }
@ Test public void shouldCreateQueryWithRegexIterable ( ) { final var builder = new QueryBuilder ( ) ; assertThat ( builder . withRegex ( "fieldName" , Arrays . asList ( "key1" , "key2" , "key3" ) ) ) . isSameAs ( builder ) ; assertThat ( builder . build ( ) ) . isEqualTo ( new JsonObject ( ) . put ( "fieldName" , new JsonObject ( ) . put ( "$all" , new JsonArray ( ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "$regex" , "key1" ) . put ( "$options" , "i" ) ) ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "$regex" , "key2" ) . put ( "$options" , "i" ) ) ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "$regex" , "key3" ) . put ( "$options" , "i" ) ) ) ) ) ) ; }
Should create query with iterable regex.
Should create query with iterable regex .