vertx/src/test/java/eu/internetofus/common/vertx/ComponentClientTest.java
/**
   * Verify that get a JSON array.
   *
   * @param vertx       platform that manage the event bus.
   * @param client      to use.
   * @param testContext context that manage the test.
   */
Verify that get a JSON array.
@param vertx       platform that manage the event bus.
@param client      to use.
@param testContext context that manage the test.
Verify that get a JSON array . @param vertx platform that manage the event bus . @param client to use . @param testContext context that manage the test .
@Test
  public void shouldGetJsonArrayWithParams(final Vertx vertx, final WebClient client,
      final VertxTestContext testContext) {
    vertx.createHttpServer().requestHandler(request -> {
      final var response = request.response();
      response.putHeader("content-type", "application/json");
      response.end("[1,2,3]");
    }).listen(0, "localhost", testContext.succeeding(server -> {
      final var service = new ComponentClient(client, "http://localhost:" + server.actualPort() + "/api");
      final var params = new HashMap<String, String>();
      params.put("key1", "1");
      params.put("key2", "2");
      params.put("key3", "3");
      service.getJsonArray(params).onComplete(testContext.succeeding(content -> testContext.verify(() -> {
        server.close();
        assertThat(content).isEqualTo(new JsonArray().add(1).add(2).add(3));
        testContext.completeNow();
      })));
    }));
  }
@ Test public void shouldGetJsonArrayWithParams ( final Vertx vertx , final WebClient client , final VertxTestContext testContext ) { vertx . createHttpServer ( ) . requestHandler ( request -> { final var response = request . response ( ) ; response . putHeader ( "content-type" , "application/json" ) ; response . end ( "[1,2,3]" ) ; } ) . listen ( 0 , "localhost" , testContext . succeeding ( server -> { final var service = new ComponentClient ( client , "http://localhost:" + server . actualPort ( ) + "/api" ) ; final var params = new HashMap < String , String > ( ) ; params . put ( "key1" , "1" ) ; params . put ( "key2" , "2" ) ; params . put ( "key3" , "3" ) ; service . getJsonArray ( params ) . onComplete ( testContext . succeeding ( content -> testContext . verify ( ( ) -> { server . close ( ) ; assertThat ( content ) . isEqualTo ( new JsonArray ( ) . add ( 1 ) . add ( 2 ) . add ( 3 ) ) ; testContext . completeNow ( ) ; } ) ) ) ; } ) ) ; }
Verify that get a JSON array.
Verify that get a JSON array .