vertx/src/test/java/eu/internetofus/common/vertx/ModelResourcesTest.java
/**
   * Should not update a value because the updated value is equals to the
   * original.
   *
   * @param resultHandler handler to manage the HTTP result.
   * @param searcher      the function used to search a model.
   * @param updater       the function used to update a model.
   *
   * @see ModelResources#updateModel( JsonObject, ModelContext, BiConsumer,
   *      BiConsumer, ServiceContext)
   */
Should not update a value because the updated value is equals to the
original.

@param resultHandler handler to manage the HTTP result.
@param searcher      the function used to search a model.
@param updater       the function used to update a model.


Should not update a value because the updated value is equals to the original . @param resultHandler handler to manage the HTTP result . @param searcher the function used to search a model . @param updater the function used to update a model .
@Test
  public void shouldUpdateModelWithNoChanges(@Mock final Handler<AsyncResult<ServiceResponse>> resultHandler,
      @Mock final BiConsumer<String, Handler<AsyncResult<DummyComplexModel>>> searcher,
      @Mock final BiConsumer<DummyComplexModel, Handler<AsyncResult<Void>>> updater) {
    final var model = this.createModelContext();
    final var context = this.createServiceContext(resultHandler);
    final var source = new DummyComplexModelTest().createModelExample(2);
    final var value = source.toJsonObject();
    ModelResources.updateModel(value, model, searcher, updater, context);
    @SuppressWarnings("unchecked")
    final ArgumentCaptor<Handler<AsyncResult<DummyComplexModel>>> storeCaptor = ArgumentCaptor.forClass(Handler.class);
    verify(searcher, timeout(30000).times(1)).accept(any(), storeCaptor.capture());
    storeCaptor.getValue().handle(Future.succeededFuture(source));
    @SuppressWarnings("unchecked")
    final ArgumentCaptor<AsyncResult<ServiceResponse>> resultCaptor = ArgumentCaptor.forClass(AsyncResult.class);
    verify(resultHandler, timeout(30000).times(1)).handle(resultCaptor.capture());
    final var asyncResult = resultCaptor.getValue();
    assertThat(asyncResult.failed()).isFalse();
    final var result = asyncResult.result();
    assertThat(result.getStatusCode()).isEqualTo(Status.OK.getStatusCode());
    final var merged = Model.fromBuffer(result.getPayload(), DummyComplexModel.class);
    assertThat(merged).isNotNull().isEqualTo(source);
  }
@ Test public void shouldUpdateModelWithNoChanges ( @ Mock final Handler < AsyncResult < ServiceResponse > > resultHandler , @ Mock final BiConsumer < String , Handler < AsyncResult < DummyComplexModel > > > searcher , @ Mock final BiConsumer < DummyComplexModel , Handler < AsyncResult < Void > > > updater ) { final var model = this . createModelContext ( ) ; final var context = this . createServiceContext ( resultHandler ) ; final var source = new DummyComplexModelTest ( ) . createModelExample ( 2 ) ; final var value = source . toJsonObject ( ) ; ModelResources . updateModel ( value , model , searcher , updater , context ) ; @ SuppressWarnings ( "unchecked" ) final ArgumentCaptor < Handler < AsyncResult < DummyComplexModel > > > storeCaptor = ArgumentCaptor . forClass ( Handler . class ) ; verify ( searcher , timeout ( 30000 ) . times ( 1 ) ) . accept ( any ( ) , storeCaptor . capture ( ) ) ; storeCaptor . getValue ( ) . handle ( Future . succeededFuture ( source ) ) ; @ SuppressWarnings ( "unchecked" ) final ArgumentCaptor < AsyncResult < ServiceResponse > > resultCaptor = ArgumentCaptor . forClass ( AsyncResult . class ) ; verify ( resultHandler , timeout ( 30000 ) . times ( 1 ) ) . handle ( resultCaptor . capture ( ) ) ; final var asyncResult = resultCaptor . getValue ( ) ; assertThat ( asyncResult . failed ( ) ) . isFalse ( ) ; final var result = asyncResult . result ( ) ; assertThat ( result . getStatusCode ( ) ) . isEqualTo ( Status . OK . getStatusCode ( ) ) ; final var merged = Model . fromBuffer ( result . getPayload ( ) , DummyComplexModel . class ) ; assertThat ( merged ) . isNotNull ( ) . isEqualTo ( source ) ; }
Should not update a value because the updated value is equals to the
 original.
Should not update a value because the updated value is equals to the original .