Answers for "Put Request Example in Java"

0

Put Request Example in Java

@BeforeAll
    public static void init(){

        RestAssured.baseURI = "........." ;
        RestAssured.port = 8000 ;
        RestAssured.basePath = "/api" ;
}
@DisplayName("Update exsiting Data")
    @Test
    public void updateSpartan(){

        String updatedBody = "{\n" +
                "        \"id\": 809,\n" +
                "        \"name\": \"Wonder Woman\",\n" +
                "        \"gender\": \"Female\",\n" +
                "        \"phone\": 1234567890\n" +
                "       }" ;

        given()
                .contentType(ContentType.JSON)
                .body(updatedBody)
                .log().all().
        when()
                .put("/spartans/{id}",809).
        then()
                .log().all()
                .statusCode(204) ;
Posted by: Guest on May-30-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language