package Assigment; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertTrue; import org.testng.annotations.Test; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.response.Response; public class RestAssured_PUT_Example { @Test public void putExample() { RestAssured.baseURI = "https://reqres.in/api"; String requestBody = "{\n" + " \"name\": \"Adam\",\n" + " \"job\": \"Software Engineer\"\n" + "}"; Response response = null; try { response = RestAssured.given() .contentType(ContentType.JSON) .body(requestBody) .put("/users/2"); } catch (Exception e) { e.printStackTrace(); } System.out.println("Response :" + response.asString()); assertEquals(200, response.getStatusCode()); assertTrue(response.jsonPath().getString("job").contains("Software")); } }