vertx/src/test/java/eu/internetofus/common/vertx/ServiceResponseHandlersTest.java
/**
   * Check the response with a JSON object.
   *
   * @param testContext context that executes the test.
   */
Check the response with a JSON object.
@param testContext context that executes the test.
Check the response with a JSON object . @param testContext context that executes the test .
@Test
  public void shouldRepondWithStringJsonObject(final VertxTestContext testContext) {
    ServiceResponseHandlers.responseWith(testContext.succeeding(reponse -> testContext.verify(() -> {
      assertThat(reponse.getStatusCode()).isEqualTo(Status.FOUND.getStatusCode());
      assertThat(reponse.getHeaders().get(HttpHeaders.CONTENT_TYPE)).isEqualTo(MediaType.APPLICATION_JSON);
      assertThat(reponse.getPayload().toString()).isEqualTo("{\"key\":\"value\"}");
      testContext.completeNow();
    })), Status.FOUND, new JsonObject().put("key", "value"));
  }
@ Test public void shouldRepondWithStringJsonObject ( final VertxTestContext testContext ) { ServiceResponseHandlers . responseWith ( testContext . succeeding ( reponse -> testContext . verify ( ( ) -> { assertThat ( reponse . getStatusCode ( ) ) . isEqualTo ( Status . FOUND . getStatusCode ( ) ) ; assertThat ( reponse . getHeaders ( ) . get ( HttpHeaders . CONTENT_TYPE ) ) . isEqualTo ( MediaType . APPLICATION_JSON ) ; assertThat ( reponse . getPayload ( ) . toString ( ) ) . isEqualTo ( "{\"key\":\"value\"}" ) ; testContext . completeNow ( ) ; } ) ) , Status . FOUND , new JsonObject ( ) . put ( "key" , "value" ) ) ; }
Check the response with a JSON object.
Check the response with a JSON object .