components/src/test/java/eu/internetofus/common/components/models/RoutineTest.java
/**
   * Check that merge only a scored label in the label distribution.
   *
   * @param vertx       event bus to use.
   * @param testContext test context to use.
   *
   * @see Routine#merge(Routine, WeNetValidateContext)
   */
Check that merge only a scored label in the label distribution.
@param vertx       event bus to use.
@param testContext test context to use.


Check that merge only a scored label in the label distribution . @param vertx event bus to use . @param testContext test context to use .
@Test
  public void shouldMergeOnlyScoredLAbelInLabelDistribution(final Vertx vertx, final VertxTestContext testContext) {
    this.createModelExample(1, vertx, testContext).onSuccess(target -> {
      final var source = new Routine();
      source.label_distribution = new JsonObject(target.label_distribution.toBuffer());
      source.label_distribution.getJsonArray("additional_1").getJsonObject(0).clear()
          .put("label", new JsonObject().put("name", "name_1").put("latitude", -43d)).put("score", 43d);
      assertCanMerge(target, source, new WeNetValidateContext("codePrefix", vertx), testContext, merged -> {
        assertThat(merged).isNotEqualTo(source).isNotEqualTo(target).isNotSameAs(target).isNotSameAs(source);
        target.label_distribution.getJsonArray("additional_1").getJsonObject(0).getJsonObject("label").put("latitude",
            -43d);
        target.label_distribution.getJsonArray("additional_1").getJsonObject(0).put("score", 43d);
        assertThat(merged).isEqualTo(target);
      });
    });
  }
@ Test public void shouldMergeOnlyScoredLAbelInLabelDistribution ( final Vertx vertx , final VertxTestContext testContext ) { this . createModelExample ( 1 , vertx , testContext ) . onSuccess ( target -> { final var source = new Routine ( ) ; source . label_distribution = new JsonObject ( target . label_distribution . toBuffer ( ) ) ; source . label_distribution . getJsonArray ( "additional_1" ) . getJsonObject ( 0 ) . clear ( ) . put ( "label" , new JsonObject ( ) . put ( "name" , "name_1" ) . put ( "latitude" , - 43d ) ) . put ( "score" , 43d ) ; assertCanMerge ( target , source , new WeNetValidateContext ( "codePrefix" , vertx ) , testContext , merged -> { assertThat ( merged ) . isNotEqualTo ( source ) . isNotEqualTo ( target ) . isNotSameAs ( target ) . isNotSameAs ( source ) ; target . label_distribution . getJsonArray ( "additional_1" ) . getJsonObject ( 0 ) . getJsonObject ( "label" ) . put ( "latitude" , - 43d ) ; target . label_distribution . getJsonArray ( "additional_1" ) . getJsonObject ( 0 ) . put ( "score" , 43d ) ; assertThat ( merged ) . isEqualTo ( target ) ; } ) ; } ) ; }
Check that merge only a scored label in the label distribution.
Check that merge only a scored label in the label distribution .