vertx/src/test/java/eu/internetofus/common/vertx/QueryBuilderTest.java
/**
   * Should create query with element equals or with regexp.
   *
   * @see QueryBuilder#withEqOrRegex(String, Iterable)
   */
Should create query with element equals or with regexp.
Should create query with element equals or with regexp .
@Test
  public void shouldCreateQueryWithElementEqOrRegex() {
    final var builder = new QueryBuilder();
    assertThat(builder.withElementEqOrRegex("fieldName", "subFieldName", Arrays.asList("value", "/re.*xp/", null)))
        .isSameAs(builder);
    assertThat(builder.build()).isEqualTo(new JsonObject().put("fieldName", new JsonObject().put("$all", new JsonArray()
        .add(new JsonObject().put("$elemMatch",
            new JsonObject().put("subFieldName", new JsonObject().put("$eq", "value"))))
        .add(new JsonObject().put("$elemMatch",
            new JsonObject().put("subFieldName", new JsonObject().put("$regex", "re.*xp").put("$options", "i")))))));
  }
@ Test public void shouldCreateQueryWithElementEqOrRegex ( ) { final var builder = new QueryBuilder ( ) ; assertThat ( builder . withElementEqOrRegex ( "fieldName" , "subFieldName" , Arrays . asList ( "value" , "/re.*xp/" , null ) ) ) . isSameAs ( builder ) ; assertThat ( builder . build ( ) ) . isEqualTo ( new JsonObject ( ) . put ( "fieldName" , new JsonObject ( ) . put ( "$all" , new JsonArray ( ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "subFieldName" , new JsonObject ( ) . put ( "$eq" , "value" ) ) ) ) . add ( new JsonObject ( ) . put ( "$elemMatch" , new JsonObject ( ) . put ( "subFieldName" , new JsonObject ( ) . put ( "$regex" , "re.*xp" ) . put ( "$options" , "i" ) ) ) ) ) ) ) ; }
Should create query with element equals or with regexp.
Should create query with element equals or with regexp .