dummy/src/test/java/eu/internetofus/wenet_dummy/api/dummies/DummiesIT.java
/**
   * Should not post dummy model with an existing identifier.
   *
   * @param vertx       that contains the event bus to use.
   * @param client      to use.
   * @param testContext context over the tests.
   */
Should not post dummy model with an existing identifier.
@param vertx       that contains the event bus to use.
@param client      to use.
@param testContext context over the tests.
Should not post dummy model with an existing identifier . @param vertx that contains the event bus to use . @param client to use . @param testContext context over the tests .
@Test
  public void shouldFailPostDummyIdDefined(Vertx vertx, final WebClient client, final VertxTestContext testContext) {
    var checkpoint = testContext.checkpoint(2);
    final var model = new DummyTest().createModelExample(1);
    model.id = null;
    testRequest(client, HttpMethod.POST, Dummies.PATH).expect(res -> {
      assertThat(res.statusCode()).isEqualTo(Status.CREATED.getStatusCode());
      final var posted = assertThatBodyIs(Dummy.class, res);
      assertThat(posted).isNotNull();
      testRequest(client, HttpMethod.POST, Dummies.PATH).expect(res2 -> {
        assertThat(res2.statusCode()).isEqualTo(Status.BAD_REQUEST.getStatusCode());
        final var error = assertThatBodyIs(ErrorMessage.class, res2);
        assertThat(error).isNotNull();
      }).sendJson(posted.toJsonObject(), testContext, checkpoint);
    }).sendJson(model, testContext, checkpoint);
  }
@ Test public void shouldFailPostDummyIdDefined ( Vertx vertx , final WebClient client , final VertxTestContext testContext ) { var checkpoint = testContext . checkpoint ( 2 ) ; final var model = new DummyTest ( ) . createModelExample ( 1 ) ; model . id = null ; testRequest ( client , HttpMethod . POST , Dummies . PATH ) . expect ( res -> { assertThat ( res . statusCode ( ) ) . isEqualTo ( Status . CREATED . getStatusCode ( ) ) ; final var posted = assertThatBodyIs ( Dummy . class , res ) ; assertThat ( posted ) . isNotNull ( ) ; testRequest ( client , HttpMethod . POST , Dummies . PATH ) . expect ( res2 -> { assertThat ( res2 . statusCode ( ) ) . isEqualTo ( Status . BAD_REQUEST . getStatusCode ( ) ) ; final var error = assertThatBodyIs ( ErrorMessage . class , res2 ) ; assertThat ( error ) . isNotNull ( ) ; } ) . sendJson ( posted . toJsonObject ( ) , testContext , checkpoint ) ; } ) . sendJson ( model , testContext , checkpoint ) ; }
Should not post dummy model with an existing identifier.
Should not post dummy model with an existing identifier .