components/src/test/java/eu/internetofus/common/components/models/WeNetUserProfileTest.java
/**
   * Check merge add modify personal behaviors.
   *
   * @param vertx       event bus to use.
   * @param testContext context to test.
   *
   * @see WeNetUserProfile#merge(WeNetUserProfile, WeNetValidateContext)
   */
Check merge add modify personal behaviors.
@param vertx       event bus to use.
@param testContext context to test.


Check merge add modify personal behaviors . @param vertx event bus to use . @param testContext context to test .
@Test
  public void shouldMergeAddModifyPersonalBehaviors(final Vertx vertx, final VertxTestContext testContext) {
    this.createModelExample(1, vertx, testContext).onSuccess(target -> {
      new RoutineTest().createModelExample(1, vertx, testContext).onSuccess(createdRoutine -> {
        final var source = new WeNetUserProfile();
        source.personalBehaviors = new ArrayList<>();
        source.personalBehaviors.add(createdRoutine);
        source.personalBehaviors.addAll(target.personalBehaviors);
        source.personalBehaviors.get(1).confidence = 0.0;
        assertCanMerge(target, source, new WeNetValidateContext("codePrefix", vertx), testContext, merged -> {
          assertThat(merged).isNotEqualTo(target).isNotEqualTo(source);
          target.personalBehaviors.add(0, createdRoutine);
          target.personalBehaviors.get(1).confidence = 0.0;
          assertThat(merged).isEqualTo(target);
        });
      });
    });
  }
@ Test public void shouldMergeAddModifyPersonalBehaviors ( final Vertx vertx , final VertxTestContext testContext ) { this . createModelExample ( 1 , vertx , testContext ) . onSuccess ( target -> { new RoutineTest ( ) . createModelExample ( 1 , vertx , testContext ) . onSuccess ( createdRoutine -> { final var source = new WeNetUserProfile ( ) ; source . personalBehaviors = new ArrayList < > ( ) ; source . personalBehaviors . add ( createdRoutine ) ; source . personalBehaviors . addAll ( target . personalBehaviors ) ; source . personalBehaviors . get ( 1 ) . confidence = 0.0 ; assertCanMerge ( target , source , new WeNetValidateContext ( "codePrefix" , vertx ) , testContext , merged -> { assertThat ( merged ) . isNotEqualTo ( target ) . isNotEqualTo ( source ) ; target . personalBehaviors . add ( 0 , createdRoutine ) ; target . personalBehaviors . get ( 1 ) . confidence = 0.0 ; assertThat ( merged ) . isEqualTo ( target ) ; } ) ; } ) ; } ) ; }
Check merge add modify personal behaviors.
Check merge add modify personal behaviors .