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


Check merge relevant locations profiles . @param vertx event bus to use . @param testContext context to test .
@Test
  public void shouldMergeWithRelevantLocations(final Vertx vertx, final VertxTestContext testContext) {
    final var target = new WeNetUserProfile();
    target.relevantLocations = new ArrayList<>();
    target.relevantLocations.add(new RelevantLocationTest().createModelExample(1));
    target.relevantLocations.get(0).id = "1";
    final var source = new WeNetUserProfile();
    source.relevantLocations = new ArrayList<>();
    source.relevantLocations.add(new RelevantLocationTest().createModelExample(1));
    source.relevantLocations.add(new RelevantLocationTest().createModelExample(2));
    source.relevantLocations.add(new RelevantLocationTest().createModelExample(3));
    source.relevantLocations.get(1).id = "1";
    assertCanMerge(target, source, new WeNetValidateContext("codePrefix", vertx), testContext, merged -> {
      assertThat(merged.relevantLocations).isNotEqualTo(target.relevantLocations).isEqualTo(source.relevantLocations);
      assertThat(merged.relevantLocations.get(0).id).isNotEmpty();
      assertThat(merged.relevantLocations.get(1).id).isEqualTo("1");
      assertThat(merged.relevantLocations.get(2).id).isNotEmpty();
    });
  }
@ Test public void shouldMergeWithRelevantLocations ( final Vertx vertx , final VertxTestContext testContext ) { final var target = new WeNetUserProfile ( ) ; target . relevantLocations = new ArrayList < > ( ) ; target . relevantLocations . add ( new RelevantLocationTest ( ) . createModelExample ( 1 ) ) ; target . relevantLocations . get ( 0 ) . id = "1" ; final var source = new WeNetUserProfile ( ) ; source . relevantLocations = new ArrayList < > ( ) ; source . relevantLocations . add ( new RelevantLocationTest ( ) . createModelExample ( 1 ) ) ; source . relevantLocations . add ( new RelevantLocationTest ( ) . createModelExample ( 2 ) ) ; source . relevantLocations . add ( new RelevantLocationTest ( ) . createModelExample ( 3 ) ) ; source . relevantLocations . get ( 1 ) . id = "1" ; assertCanMerge ( target , source , new WeNetValidateContext ( "codePrefix" , vertx ) , testContext , merged -> { assertThat ( merged . relevantLocations ) . isNotEqualTo ( target . relevantLocations ) . isEqualTo ( source . relevantLocations ) ; assertThat ( merged . relevantLocations . get ( 0 ) . id ) . isNotEmpty ( ) ; assertThat ( merged . relevantLocations . get ( 1 ) . id ) . isEqualTo ( "1" ) ; assertThat ( merged . relevantLocations . get ( 2 ) . id ) . isNotEmpty ( ) ; } ) ; }
Check merge relevant locations profiles.
Check merge relevant locations profiles .