vertx/src/test/java/eu/internetofus/common/vertx/basic/BadRequestHandlerIT.java
/**
   * Should not create a user when the body is not valid.
   *
   * @param client      to connect to the server.
   * @param testContext context to test.
   */
Should not create a user when the body is not valid.
@param client      to connect to the server.
@param testContext context to test.
Should not create a user when the body is not valid . @param client to connect to the server . @param testContext context to test .
@Test
  public void shouldInformAboutBadBodyFieldWhenCreateUser(final WebClient client, final VertxTestContext testContext) {
    testRequest(client, HttpMethod.POST, Users.PATH).expect(res -> {
      assertThat(res.statusCode()).isEqualTo(Status.BAD_REQUEST.getStatusCode());
      final var error = assertThatBodyIs(ErrorMessage.class, res);
      assertThat(error.code).isEqualTo("bad_body_name");
      assertThat(error.message).isEqualTo("input don't match type STRING");
    }).sendJson(new JsonObject().put("name", true), testContext);
  }
@ Test public void shouldInformAboutBadBodyFieldWhenCreateUser ( final WebClient client , final VertxTestContext testContext ) { testRequest ( client , HttpMethod . POST , Users . PATH ) . expect ( res -> { assertThat ( res . statusCode ( ) ) . isEqualTo ( Status . BAD_REQUEST . getStatusCode ( ) ) ; final var error = assertThatBodyIs ( ErrorMessage . class , res ) ; assertThat ( error . code ) . isEqualTo ( "bad_body_name" ) ; assertThat ( error . message ) . isEqualTo ( "input don't match type STRING" ) ; } ) . sendJson ( new JsonObject ( ) . put ( "name" , true ) , testContext ) ; }
Should not create a user when the body is not valid.
Should not create a user when the body is not valid .