vertx/src/test/java/eu/internetofus/common/vertx/AbstractModelResourcesIT.java
/**
   * Should not merge with an invalid model.
   *
   * @param vertx       event bus to use.
   * @param client      to connect to the server.
   * @param testContext context to test.
   */
Should not merge with an invalid model.
@param vertx       event bus to use.
@param client      to connect to the server.
@param testContext context to test.
Should not merge with an invalid model . @param vertx event bus to use . @param client to connect to the server . @param testContext context to test .
@Test
  public void shouldNotMergeWithInvalidModel(final Vertx vertx, final WebClient client,
      final VertxTestContext testContext) {
    testContext.assertComplete(this.createValidModelExample(1, vertx, testContext)).onSuccess(source -> {
      testContext.assertComplete(this.storeModel(source, vertx, testContext)).onSuccess(stored -> {
        final var invalid = this.createInvalidModel();
        testRequest(client, HttpMethod.PATCH, this.modelPath() + "/" + this.idOf(stored)).expect(res -> {
          assertThat(res.statusCode()).isEqualTo(Status.BAD_REQUEST.getStatusCode());
          final var error = assertThatBodyIs(ErrorMessage.class, res);
          assertThat(error.code).isNotEmpty();
          assertThat(error.message).isNotEmpty().isNotEqualTo(error.code);
        }).sendJson(invalid.toJsonObject(), testContext);
      });
    });
  }
@ Test public void shouldNotMergeWithInvalidModel ( final Vertx vertx , final WebClient client , final VertxTestContext testContext ) { testContext . assertComplete ( this . createValidModelExample ( 1 , vertx , testContext ) ) . onSuccess ( source -> { testContext . assertComplete ( this . storeModel ( source , vertx , testContext ) ) . onSuccess ( stored -> { final var invalid = this . createInvalidModel ( ) ; testRequest ( client , HttpMethod . PATCH , this . modelPath ( ) + "/" + this . idOf ( stored ) ) . expect ( res -> { assertThat ( res . statusCode ( ) ) . isEqualTo ( Status . BAD_REQUEST . getStatusCode ( ) ) ; final var error = assertThatBodyIs ( ErrorMessage . class , res ) ; assertThat ( error . code ) . isNotEmpty ( ) ; assertThat ( error . message ) . isNotEmpty ( ) . isNotEqualTo ( error . code ) ; } ) . sendJson ( invalid . toJsonObject ( ) , testContext ) ; } ) ; } ) ; }
Should not merge with an invalid model.
Should not merge with an invalid model .