vertx/src/test/java/eu/internetofus/common/vertx/AbstractModelFieldResourcesIT.java
/**
   * Should create an element over a {@code null} field.
   *
   * @param vertx       event bus to use.
   * @param client      to connect to the server.
   * @param testContext context to test.
   */
Should create an element over a  null field.
@param vertx       event bus to use.
@param client      to connect to the server.
@param testContext context to test.
Should create an element over a null field . @param vertx event bus to use . @param client to connect to the server . @param testContext context to test .
@Test
  public void shouldCreateElementOverNullField(final Vertx vertx, final WebClient client,
      final VertxTestContext testContext) {
    testContext.assertComplete(this.storeValidExampleModelWithNullField(1, vertx, testContext)).onSuccess(model -> {
      testContext.assertComplete(this.createValidModelFieldElementExample(100, vertx, testContext))
          .onSuccess(element -> {
            final var checkpoint = testContext.checkpoint(2);
            final var postPath = this.modelPath() + "/" + this.idOfModel(model, testContext) + this.fieldPath();
            testRequest(client, HttpMethod.POST, postPath).expect(res -> {
              assertThat(res.statusCode()).isEqualTo(Status.OK.getStatusCode());
              @SuppressWarnings("unchecked")
              final var created = (E) assertThatBodyIs(element.getClass(), res);
              this.assertEqualsAdded(element, created);
              final var getPath = this.modelPath() + "/" + this.idOfModel(model, testContext);
              testRequest(client, HttpMethod.GET, getPath).expect(resRetrieve -> {
                assertThat(resRetrieve.statusCode()).isEqualTo(Status.OK.getStatusCode());
                @SuppressWarnings("unchecked")
                final var updatedModel = (T) assertThatBodyIs(model.getClass(), resRetrieve);
                final var updatedField = this.fieldOf(updatedModel);
                assertThat(updatedField).isNotEmpty().contains(created);
              }).sendJson(element.toJsonObject(), testContext, checkpoint);
            }).sendJson(element.toJsonObject(), testContext, checkpoint);
          });
    });
  }
@ Test public void shouldCreateElementOverNullField ( final Vertx vertx , final WebClient client , final VertxTestContext testContext ) { testContext . assertComplete ( this . storeValidExampleModelWithNullField ( 1 , vertx , testContext ) ) . onSuccess ( model -> { testContext . assertComplete ( this . createValidModelFieldElementExample ( 100 , vertx , testContext ) ) . onSuccess ( element -> { final var checkpoint = testContext . checkpoint ( 2 ) ; final var postPath = this . modelPath ( ) + "/" + this . idOfModel ( model , testContext ) + this . fieldPath ( ) ; testRequest ( client , HttpMethod . POST , postPath ) . expect ( res -> { assertThat ( res . statusCode ( ) ) . isEqualTo ( Status . OK . getStatusCode ( ) ) ; @ SuppressWarnings ( "unchecked" ) final var created = ( E ) assertThatBodyIs ( element . getClass ( ) , res ) ; this . assertEqualsAdded ( element , created ) ; final var getPath = this . modelPath ( ) + "/" + this . idOfModel ( model , testContext ) ; testRequest ( client , HttpMethod . GET , getPath ) . expect ( resRetrieve -> { assertThat ( resRetrieve . statusCode ( ) ) . isEqualTo ( Status . OK . getStatusCode ( ) ) ; @ SuppressWarnings ( "unchecked" ) final var updatedModel = ( T ) assertThatBodyIs ( model . getClass ( ) , resRetrieve ) ; final var updatedField = this . fieldOf ( updatedModel ) ; assertThat ( updatedField ) . isNotEmpty ( ) . contains ( created ) ; } ) . sendJson ( element . toJsonObject ( ) , testContext , checkpoint ) ; } ) . sendJson ( element . toJsonObject ( ) , testContext , checkpoint ) ; } ) ; } ) ; }
Should create an element over a {@code null} field.
Should create an element over a { @code null } field .