-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasics.java
More file actions
45 lines (31 loc) · 1.52 KB
/
Copy pathbasics.java
File metadata and controls
45 lines (31 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import io.restassured.RestAssured;
import io.restassured.path.json.JsonPath;
import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
import files.payload;
public class basics {
public static void main(String[] args) {
// TODO Auto-generated method stub
RestAssured.baseURI="https://rahulshettyacademy.com";
String ans=given().log().all().queryParam("key", "qaclick123").header("Content-Type", "application/json")
.body(payload.AddPlace()).when().post("maps/api/place/add/json").then().log().all().assertThat()
.statusCode(200).body("scope", equalTo("APP")).header("Server", "Apache/2.4.18 (Ubuntu)").extract()
.response().asString();
System.out.println(ans);
JsonPath js=new JsonPath(ans);
String pl_id=js.getString("place_id");
System.out.println(pl_id);
// Update Place
String nAddrss="11 Winter V Street, CBE";
given().log().all().queryParam("key", "qaclick123").header("Content-Type", "application/json")
.body(payload.UpdatePlace(pl_id, nAddrss)).when().put("maps/api/place/update/json").then().assertThat()
.log().all().statusCode(200).body("msg", equalTo("Address successfully updated"));
// Get Place
String getPlaceResp=given().log().all().queryParam("key", "qaclick123").queryParam("place_id", pl_id).when()
.get("maps/api/place/get/json").then().log().all().assertThat().statusCode(200).extract().response()
.asString();
JsonPath js2=new JsonPath(getPlaceResp);
String actAddrss=js2.getString("address");
System.out.println(actAddrss);
}
}