dummy/src/test/java/eu/internetofus/wenet_dummy/api/echo/EchoIT.java
/**
   * Should post dummy model.
   *
   * @param vertx       that contains the event bus to use.
   * @param client      to use.
   * @param testContext context over the tests.
   */
Should post dummy model.
@param vertx       that contains the event bus to use.
@param client      to use.
@param testContext context over the tests.
Should post dummy model . @param vertx that contains the event bus to use . @param client to use . @param testContext context over the tests .
@Test
  public void shouldPostDummyModel(final Vertx vertx, final WebClient client, final VertxTestContext testContext) {
    final var model = new DummyModel();
    model.children = new ArrayList<>();
    model.children.add(new DummyModel());
    model.children.add(new DummyModel());
    model.children.add(new DummyModel());
    model.children.get(1).name = "Name";
    model.children.get(1).parent = new DummyParentModel();
    model.children.get(1).parent.name = "Parent";
    final var modelObject = new JsonObject(model.toBufferWithEmptyValues());
    testRequest(client, HttpMethod.POST, Echo.PATH + "/dummy").expect(res -> {
      assertThat(res.statusCode()).isEqualTo(Status.CREATED.getStatusCode());
      final var posted = res.bodyAsJsonObject();
      assertThat(posted).isNotNull().isEqualTo(modelObject);
      final var postedModel = Model.fromJsonObject(posted, DummyModel.class);
      assertThat(postedModel).isEqualTo(model);
    }).sendJson(modelObject, testContext);
  }
@ Test public void shouldPostDummyModel ( final Vertx vertx , final WebClient client , final VertxTestContext testContext ) { final var model = new DummyModel ( ) ; model . children = new ArrayList < > ( ) ; model . children . add ( new DummyModel ( ) ) ; model . children . add ( new DummyModel ( ) ) ; model . children . add ( new DummyModel ( ) ) ; model . children . get ( 1 ) . name = "Name" ; model . children . get ( 1 ) . parent = new DummyParentModel ( ) ; model . children . get ( 1 ) . parent . name = "Parent" ; final var modelObject = new JsonObject ( model . toBufferWithEmptyValues ( ) ) ; testRequest ( client , HttpMethod . POST , Echo . PATH + "/dummy" ) . expect ( res -> { assertThat ( res . statusCode ( ) ) . isEqualTo ( Status . CREATED . getStatusCode ( ) ) ; final var posted = res . bodyAsJsonObject ( ) ; assertThat ( posted ) . isNotNull ( ) . isEqualTo ( modelObject ) ; final var postedModel = Model . fromJsonObject ( posted , DummyModel . class ) ; assertThat ( postedModel ) . isEqualTo ( model ) ; } ) . sendJson ( modelObject , testContext ) ; }
Should post dummy model.
Should post dummy model .