vertx/src/test/java/eu/internetofus/common/vertx/AbstractModelFieldResourcesIT.java
/**
   * Should retrieve element.
   *
   * @param vertx       event bus to use.
   * @param client      to connect to the server.
   * @param testContext context to test.
   */
Should retrieve element.
@param vertx       event bus to use.
@param client      to connect to the server.
@param testContext context to test.
Should retrieve element . @param vertx event bus to use . @param client to connect to the server . @param testContext context to test .
@Test
  public void shouldRetrieveElement(final Vertx vertx, final WebClient client, final VertxTestContext testContext) {
    testContext.assertComplete(this.storeValidExampleModelWithFieldElements(4, vertx, testContext)).onSuccess(model -> {
      final var modelId = this.idOfModel(model, testContext);
      final var field = this.fieldOf(model, testContext);
      final var element = field.get(field.size() - 1);
      final var elementId = this.idOfElementIn(model, element);
      final var path = this.modelPath() + "/" + modelId + this.fieldPath() + "/" + elementId;
      testRequest(client, HttpMethod.GET, path).expect(res -> {
        assertThat(res.statusCode()).isEqualTo(Status.OK.getStatusCode());
        final var retrievedElement = assertThatBodyIs(this.fieldElementClass(), res);
        assertThat(retrievedElement).isNotNull().isEqualTo(element);
      }).send(testContext);
    });
  }
@ Test public void shouldRetrieveElement ( final Vertx vertx , final WebClient client , final VertxTestContext testContext ) { testContext . assertComplete ( this . storeValidExampleModelWithFieldElements ( 4 , vertx , testContext ) ) . onSuccess ( model -> { final var modelId = this . idOfModel ( model , testContext ) ; final var field = this . fieldOf ( model , testContext ) ; final var element = field . get ( field . size ( ) - 1 ) ; final var elementId = this . idOfElementIn ( model , element ) ; final var path = this . modelPath ( ) + "/" + modelId + this . fieldPath ( ) + "/" + elementId ; testRequest ( client , HttpMethod . GET , path ) . expect ( res -> { assertThat ( res . statusCode ( ) ) . isEqualTo ( Status . OK . getStatusCode ( ) ) ; final var retrievedElement = assertThatBodyIs ( this . fieldElementClass ( ) , res ) ; assertThat ( retrievedElement ) . isNotNull ( ) . isEqualTo ( element ) ; } ) . send ( testContext ) ; } ) ; }
Should retrieve element.
Should retrieve element .