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


Check merge add modify relevant locations . @param vertx event bus to use . @param testContext context to test .
@Test
  public void shouldMergeAddModifyRelevantLocations(final Vertx vertx, final VertxTestContext testContext) {
    this.createModelExample(1, vertx, testContext).onSuccess(created -> {
      assertIsValid(created, new WeNetValidateContext("codePrefix", vertx), testContext, () -> {
        StoreServices.storeProfile(created, vertx, testContext).onSuccess(target -> {
          final var source = new WeNetUserProfile();
          source.relevantLocations = new ArrayList<>();
          source.relevantLocations.add(new RelevantLocation());
          source.relevantLocations.add(new RelevantLocationTest().createModelExample(1));
          source.relevantLocations.get(1).id = target.relevantLocations.get(0).id;
          source.relevantLocations.get(1).label = "NEW label";
          assertCanMerge(target, source, new WeNetValidateContext("codePrefix", vertx), testContext, merged -> {
            assertThat(merged).isNotEqualTo(target).isNotEqualTo(source);
            target.relevantLocations.add(0, new RelevantLocation());
            target.relevantLocations.get(0).id = merged.relevantLocations.get(0).id;
            target.relevantLocations.get(1).label = "NEW label";
            assertThat(merged).isEqualTo(target);
          });
        });
      });
    });
  }
@ Test public void shouldMergeAddModifyRelevantLocations ( final Vertx vertx , final VertxTestContext testContext ) { this . createModelExample ( 1 , vertx , testContext ) . onSuccess ( created -> { assertIsValid ( created , new WeNetValidateContext ( "codePrefix" , vertx ) , testContext , ( ) -> { StoreServices . storeProfile ( created , vertx , testContext ) . onSuccess ( target -> { final var source = new WeNetUserProfile ( ) ; source . relevantLocations = new ArrayList < > ( ) ; source . relevantLocations . add ( new RelevantLocation ( ) ) ; source . relevantLocations . add ( new RelevantLocationTest ( ) . createModelExample ( 1 ) ) ; source . relevantLocations . get ( 1 ) . id = target . relevantLocations . get ( 0 ) . id ; source . relevantLocations . get ( 1 ) . label = "NEW label" ; assertCanMerge ( target , source , new WeNetValidateContext ( "codePrefix" , vertx ) , testContext , merged -> { assertThat ( merged ) . isNotEqualTo ( target ) . isNotEqualTo ( source ) ; target . relevantLocations . add ( 0 , new RelevantLocation ( ) ) ; target . relevantLocations . get ( 0 ) . id = merged . relevantLocations . get ( 0 ) . id ; target . relevantLocations . get ( 1 ) . label = "NEW label" ; assertThat ( merged ) . isEqualTo ( target ) ; } ) ; } ) ; } ) ; } ) ; }
Check merge add modify relevant locations.
Check merge add modify relevant locations .