put request example in java

Solutions on MaxInterview for put request example in java by the best coders in the world

showing results for - "put request example in java"
Lorenzo
07 Aug 2017
1@BeforeAll
2    public static void init(){
3
4        RestAssured.baseURI = "........." ;
5        RestAssured.port = 8000 ;
6        RestAssured.basePath = "/api" ;
7}
8@DisplayName("Update exsiting Data")
9    @Test
10    public void updateSpartan(){
11
12        String updatedBody = "{\n" +
13                "        \"id\": 809,\n" +
14                "        \"name\": \"Wonder Woman\",\n" +
15                "        \"gender\": \"Female\",\n" +
16                "        \"phone\": 1234567890\n" +
17                "       }" ;
18
19        given()
20                .contentType(ContentType.JSON)
21                .body(updatedBody)
22                .log().all().
23        when()
24                .put("/spartans/{id}",809).
25        then()
26                .log().all()
27                .statusCode(204) ;