vertx/src/test/java/eu/internetofus/common/vertx/RepositoryIT.java
/**
   * Insert into a collection some {@link DummyModel} where add in some schema
   * version values.
   *
   * @param collectionName name of the collection to add the models.
   * @param size           the number of models to insert.
   * @param testContext    context for the test.
   * @param success        to call when the model has been inserted.
   */
Insert into a collection some  DummyModel where add in some schema
version values.

@param collectionName name of the collection to add the models.
@param size           the number of models to insert.
@param testContext    context for the test.
@param success        to call when the model has been inserted.
Insert into a collection some DummyModel where add in some schema version values . @param collectionName name of the collection to add the models . @param size the number of models to insert . @param testContext context for the test . @param success to call when the model has been inserted .
protected void createAndInsertDummyModelsWithSchemaVersionsTo(final String collectionName, final int size,
      final VertxTestContext testContext, final Runnable success) {
    if (size <= 0) {
      success.run();
    } else {
      final var model = new DummyModel();
      model.index = size;
      var document = model.toJsonObject();
      if (size % 2 == 0) {
        document = document.put(Repository.SCHEMA_VERSION, size);
      } else if (size % 3 == 0) {
        document = document.put(Repository.SCHEMA_VERSION, String.valueOf(size));
      } else if (size % 5 == 0) {
        document = document.put(Repository.SCHEMA_VERSION, new JsonArray().add(size).add("2"));
      } else if (size % 7 == 0) {
        document = document.put(Repository.SCHEMA_VERSION, new JsonObject().put("size", size));
      }
      pool.insert(collectionName, document, testContext.succeeding(stored -> this
          .createAndInsertDummyModelsWithSchemaVersionsTo(collectionName, size - 1, testContext, success)));
    }
  }
protected void createAndInsertDummyModelsWithSchemaVersionsTo ( final String collectionName , final int size , final VertxTestContext testContext , final Runnable success ) { if ( size <= 0 ) { success . run ( ) ; } else { final var model = new DummyModel ( ) ; model . index = size ; var document = model . toJsonObject ( ) ; if ( size % 2 == 0 ) { document = document . put ( Repository . SCHEMA_VERSION , size ) ; } else if ( size % 3 == 0 ) { document = document . put ( Repository . SCHEMA_VERSION , String . valueOf ( size ) ) ; } else if ( size % 5 == 0 ) { document = document . put ( Repository . SCHEMA_VERSION , new JsonArray ( ) . add ( size ) . add ( "2" ) ) ; } else if ( size % 7 == 0 ) { document = document . put ( Repository . SCHEMA_VERSION , new JsonObject ( ) . put ( "size" , size ) ) ; } pool . insert ( collectionName , document , testContext . succeeding ( stored -> this . createAndInsertDummyModelsWithSchemaVersionsTo ( collectionName , size - 1 , testContext , success ) ) ) ; } }
Insert into a collection some {@link DummyModel} where add in some schema
 version values.
Insert into a collection some { @link DummyModel } where add in some schema version values .