Class VitamRestTestClient

java.lang.Object
fr.gouv.vitam.common.external.client.DefaultClient
fr.gouv.vitam.common.external.client.VitamRestTestClient
All Implemented Interfaces:
MockOrRestClient, BasicClient, VitamAutoCloseable, AutoCloseable

public class VitamRestTestClient extends DefaultClient
Vitam Restassured like client for Junit test

Example:
 
   GET http://host:port/service/v1/resource/path1/monid1/path2/monid2
      Header: X-Request-Id = abcd
      Body = Json(body)
      Expected: OK
   int statusCode = testClient.given().accept(MediaType.APPLICATION_JSON_TYPE)
         .addHeader("X-Request-Id", "abcd")
         .addPathParameter("path1", "monid1").addPathParameter("path2", "monid2")
         .body(body, MediaType.APPLICATION_JSON_TYPE)
         .status(Status.OK).get("resource");

   POST http://host:port/service/v1/resource/path1/monid1/path2/monid2
      Header: X-Request-Id = abcd
      Body = Json(body)
      Expected: OK + Body: InputStream
   InputStream stream = testClient.given().accept(MediaType.APPLICATION_OCTET_STREAM_TYPE)
         .addHeader("X-Request-Id", "abcd")
         .addPathParameter("path1", "monid1").addPathParameter("path2", "monid2")
         .body(body, MediaType.APPLICATION_JSON_TYPE)
         .status(Status.OK).get("resource", InputStream.class);