├── .idea
├── .gitignore
├── compiler.xml
├── jarRepositories.xml
├── misc.xml
├── uiDesigner.xml
└── vcs.xml
├── pom.xml
├── src
└── test
│ └── java
│ ├── TestDatalari
│ ├── TestDataDummyExample.java
│ ├── TestDataHerokuapp.java
│ └── TestDataJsonPlaceholder.java
│ ├── Tests
│ ├── C01_Get_ResponseBodyYazdirma.java
│ ├── C02_Get_ResponseBilgilerininManuelTestEdilmesi.java
│ ├── C03_Get_ResponseDegerleriniOtomasyonIleTestEtme.java
│ ├── C04_JsonObjesiOlusturma.java
│ ├── C05_JsonObjesiOlusturma.java
│ ├── C06_Put_ResponseBilgileriAssertion.java
│ ├── C07_Get_ResponseBodyTesti.java
│ ├── C08_Post_ResponseBodyTesti.java
│ ├── C09_Get_TestYaparkenTekrarlardanKurtulma.java
│ ├── C10_JsonPathKullanimi.java
│ ├── C11_Post_JsonPathIleBodyTesti.java
│ ├── C12_Get_ResponseBodyTestiListKullanimi.java
│ ├── C13_Get_ExpectedDataOlusturma.java
│ ├── C14_Post_ExpectedDataVeJsonPathIleAssertion.java
│ ├── C15_Get_SoftAssertIleExpectedDataTesti.java
│ ├── C16_Put_SoftAssertIleExpectedDataTesti.java
│ ├── C17_BaseUrlDummyRestapi.java
│ ├── C18_BaseUrlDummyRestapi2.java
│ ├── C19_BaseUrlHerokuapp.java
│ ├── C20_BaseUrlHerokuapp2.java
│ ├── C21_BaseUrlHerokuappQueryParam.java
│ ├── C22_BaseUrlHerokuappQueryParam.java
│ ├── C23_Get_TestDataClassKullanimi.java
│ ├── C24_Get_TestDataClassKullanimiDinamik.java
│ ├── C25_Put_TestDataClassKullanimi.java
│ ├── C26_Get_TestDataClassKullanimi.java
│ ├── C27_Post_TestDataClassKullanimi.java
│ ├── C28_Put_DeSerialization.java
│ ├── C29_Get_DeSerialization.java
│ ├── C30_Post_Deserialization.java
│ ├── C31_Put_PojoClass.java
│ ├── C32_Post_Pojo.java
│ ├── C33_Get_Pojo.java
│ └── C34_Post_Pojo.java
│ ├── baseUrl
│ ├── BaseUrlDummyExample.java
│ ├── BaseUrlHerokuapp.java
│ └── BaseUrlJsonPlaceholder.java
│ └── pojos
│ ├── PojoDummyExampleData.java
│ ├── PojoDummyExampleResponse.java
│ ├── PojoHerokuappBookingdates.java
│ ├── PojoHerokuappRequestBody.java
│ ├── PojoHerokuappResponseBody.java
│ ├── PojoJsonPlaceholder.java
│ └── pojosHavaDurumu
│ ├── Clouds.java
│ ├── Coord.java
│ ├── Main.java
│ ├── PojoHavaDurumu.java
│ ├── Sys.java
│ ├── Weather.java
│ └── Wind.java
└── target
└── test-classes
├── TestDatalari
├── TestDataDummyExample.class
├── TestDataHerokuapp.class
└── TestDataJsonPlaceholder.class
├── Tests
├── C01_Get_ResponseBodyYazdirma.class
├── C02_Get_ResponseBilgilerininManuelTestEdilmesi.class
├── C03_Get_ResponseDegerleriniOtomasyonIleTestEtme.class
├── C04_JsonObjesiOlusturma.class
├── C05_JsonObjesiOlusturma.class
├── C06_Put_ResponseBilgileriAssertion.class
├── C07_Get_ResponseBodyTesti.class
├── C08_Post_ResponseBodyTesti.class
├── C09_Get_TestYaparkenTekrarlardanKurtulma.class
├── C10_JsonPathKullanimi.class
├── C11_Post_JsonPathIleBodyTesti.class
├── C12_Get_ResponseBodyTestiListKullanimi.class
├── C13_Get_ExpectedDataOlusturma.class
├── C14_Post_ExpectedDataVeJsonPathIleAssertion.class
├── C15_Get_SoftAssertIleExpectedDataTesti.class
├── C16_Put_SoftAssertIleExpectedDataTesti.class
├── C17_BaseUrlDummyRestapi.class
├── C18_BaseUrlDummyRestapi2.class
├── C19_BaseUrlHerokuapp.class
├── C20_BaseUrlHerokuapp2.class
├── C21_BaseUrlHerokuappQueryParam.class
├── C22_BaseUrlHerokuappQueryParam.class
├── C23_Get_TestDataClassKullanimi.class
├── C24_Get_TestDataClassKullanimiDinamik.class
├── C25_Put_TestDataClassKullanimi.class
├── C26_Get_TestDataClassKullanimi.class
├── C27_Post_TestDataClassKullanimi.class
├── C28_Put_DeSerialization.class
├── C29_Get_DeSerialization.class
├── C30_Post_Deserialization.class
├── C31_Put_PojoClass.class
├── C32_Post_Pojo.class
├── C33_Get_Pojo.class
└── C34_Post_Pojo.class
├── baseUrl
├── BaseUrlDummyExample.class
├── BaseUrlHerokuapp.class
└── BaseUrlJsonPlaceholder.class
└── pojos
├── PojoDummyExampleData.class
├── PojoDummyExampleResponse.class
├── PojoHerokuappBookingdates.class
├── PojoHerokuappRequestBody.class
├── PojoHerokuappResponseBody.class
├── PojoJsonPlaceholder.class
└── pojosHavaDurumu
├── Clouds.class
├── Coord.class
├── Main.class
├── PojoHavaDurumu.class
├── Sys.class
├── Weather.class
└── Wind.class
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/uiDesigner.xml:
--------------------------------------------------------------------------------
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 |
46 | -
47 |
48 |
49 |
50 |
51 | -
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 |
60 |
61 | -
62 |
63 |
64 |
65 |
66 | -
67 |
68 |
69 |
70 |
71 | -
72 |
73 |
74 | -
75 |
76 |
77 |
78 |
79 | -
80 |
81 |
82 |
83 |
84 | -
85 |
86 |
87 |
88 |
89 | -
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 |
98 |
99 | -
100 |
101 |
102 | -
103 |
104 |
105 | -
106 |
107 |
108 | -
109 |
110 |
111 | -
112 |
113 |
114 |
115 |
116 | -
117 |
118 |
119 | -
120 |
121 |
122 |
123 |
124 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | org.example
8 | APITestOtomasyonu
9 | 1.0-SNAPSHOT
10 |
11 |
12 | 11
13 | 11
14 |
15 |
16 |
17 |
18 |
19 | org.json
20 | json
21 | 20220320
22 |
23 |
24 |
25 |
26 | junit
27 | junit
28 | 4.13.2
29 | test
30 |
31 |
32 |
33 | io.rest-assured
34 | rest-assured
35 | 5.2.0
36 | test
37 |
38 |
39 |
40 | org.testng
41 | testng
42 | 7.7.0
43 | test
44 |
45 |
46 |
47 | com.google.code.gson
48 | gson
49 | 2.9.0
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/test/java/TestDatalari/TestDataDummyExample.java:
--------------------------------------------------------------------------------
1 | package TestDatalari;
2 |
3 | import org.json.JSONObject;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | public class TestDataDummyExample {
9 |
10 | public static int basariliSorguStatusCode=200;
11 | public static String contentType="application/json";
12 |
13 | /*
14 | {
15 | "status":"success",
16 | "data":{
17 | "id":3,
18 | "employee_name":"Ashton Cox",
19 | "employee_salary":86000,
20 | "employee_age":66,
21 | "profile_image":""
22 | },
23 | "message":"Successfully! Record has been fetched."
24 | }
25 | */
26 |
27 | public static JSONObject jsonResponseBodyOlustur(int id,
28 | String employee_name,
29 | int employee_salary,
30 | int employee_age,
31 | String profile_image){
32 |
33 | JSONObject responseBody= new JSONObject();
34 | JSONObject dataBody= new JSONObject();
35 |
36 | dataBody.put("id",id);
37 | dataBody.put("employee_name",employee_name);
38 | dataBody.put("employee_salary",employee_salary);
39 | dataBody.put("employee_age",employee_age);
40 | dataBody.put("profile_image",profile_image);
41 |
42 | responseBody.put("status","success");
43 | responseBody.put("data",dataBody);
44 | responseBody.put("message","Successfully! Record has been fetched.");
45 |
46 | return responseBody;
47 | }
48 |
49 |
50 | /*
51 | {
52 | "status":"success",
53 | "data":{
54 | "id":3,
55 | "employee_name":"Ashton Cox",
56 | "employee_salary":86000,
57 | "employee_age":66,
58 | "profile_image":""
59 | },
60 | "message":"Successfully! Record has been fetched."
61 | }
62 | */
63 |
64 | public static Map mapBodyOlustur(){
65 |
66 | Map bodyMap= new HashMap<>();
67 | Map dataMap= new HashMap<>();
68 |
69 | dataMap.put("id",3.0);
70 | dataMap.put("employee_name","Ashton Cox");
71 | dataMap.put("employee_salary",86000.0);
72 | dataMap.put("employee_age",66.0);
73 | dataMap.put("profile_image","");
74 |
75 | bodyMap.put("status","success");
76 | bodyMap.put("data",dataMap);
77 | bodyMap.put("message","Successfully! Record has been fetched.");
78 |
79 | return bodyMap;
80 | }
81 |
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/test/java/TestDatalari/TestDataHerokuapp.java:
--------------------------------------------------------------------------------
1 | package TestDatalari;
2 |
3 | import org.json.JSONObject;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | public class TestDataHerokuapp {
9 |
10 | /*
11 | {
12 | "firstname" : "Mehmet",
13 | "lastname" : “Dag",
14 | "totalprice" : 500,
15 | "depositpaid" : false,
16 | "bookingdates" : {
17 | "checkin" : "2021-06-01",
18 | "checkout" : "2021-06-10"
19 | },
20 | "additionalneeds" : "wi-fi"
21 | }
22 | */
23 |
24 | public static JSONObject jsonRequestBodyOlustur(){
25 |
26 | JSONObject requestBody= new JSONObject();
27 | JSONObject bookingdatesBody= new JSONObject();
28 |
29 | bookingdatesBody.put("checkin","2021-06-01");
30 | bookingdatesBody.put("checkout","2021-06-10");
31 |
32 | requestBody.put("firstname","Mehmet");
33 | requestBody.put("lastname","Dag");
34 | requestBody.put("totalprice",500);
35 | requestBody.put("depositpaid",false);
36 | requestBody.put("bookingdates",bookingdatesBody);
37 | requestBody.put("additionalneeds","wi-fi");
38 |
39 | return requestBody;
40 |
41 | }
42 |
43 | /*
44 | {
45 | "bookingid":24,
46 | "booking":{
47 | "firstname":"Mehmet",
48 | "lastname":"Dag",
49 | "totalprice":500,
50 | "depositpaid":false,
51 | "bookingdates":{
52 | "checkin":"2021-06-01",
53 | "checkout":"2021-06-10"
54 | },
55 | "additionalneeds":"wi-fi"
56 | }
57 | }
58 | */
59 |
60 | public static JSONObject jsonResponseBodyOlustur(){
61 |
62 | JSONObject responseBody= new JSONObject();
63 | JSONObject bookingBody= jsonRequestBodyOlustur();
64 |
65 | responseBody.put("bookingid",24);
66 | responseBody.put("booking",bookingBody);
67 |
68 | return responseBody;
69 | }
70 |
71 | /*
72 | {
73 | "firstname" : "Ahmet",
74 | "lastname" : “Bulut",
75 | "totalprice" : 500,
76 | "depositpaid" : false,
77 | "bookingdates" : {
78 | "checkin" : "2021-06-01",
79 | "checkout" : "2021-06-10"
80 | },
81 | "additionalneeds" : "wi-fi"
82 | }
83 | */
84 |
85 | public static Map requestBodyMapOlustur(){
86 |
87 | Map requestBodyMap= new HashMap<>();
88 | requestBodyMap.put("firstname","Ahmet");
89 | requestBodyMap.put("lastname","Bulut");
90 | requestBodyMap.put("totalprice",500.0);
91 | requestBodyMap.put("depositpaid",false);
92 | requestBodyMap.put("bookingdates",bookingdatesMapOlustur());
93 | requestBodyMap.put("additionalneeds","wi-fi");
94 |
95 | return requestBodyMap;
96 | }
97 |
98 | public static Map bookingdatesMapOlustur(){
99 |
100 | Map bookingdatesMap= new HashMap<>();
101 | bookingdatesMap.put("checkin","2021-06-01");
102 | bookingdatesMap.put("checkout","2021-06-10");
103 |
104 | return bookingdatesMap;
105 | }
106 |
107 | /*
108 | Response Body // expected data
109 | {
110 | "bookingid":24,
111 | "booking":{
112 | "firstname":"Ahmet",
113 | "lastname":"Bulut",
114 | "totalprice":500,
115 | "depositpaid":false,
116 | "bookingdates":{
117 | "checkin":"2021-06-01",
118 | "checkout":"2021-06-10"
119 | ,
120 | "additionalneeds":"wi-fi"
121 | }
122 | */
123 |
124 | public static Map responseBodyMapOlustur(){
125 |
126 | Map responseBodyMap= new HashMap<>();
127 |
128 | responseBodyMap.put("bookingid",24);
129 | responseBodyMap.put("booking",requestBodyMapOlustur());
130 |
131 | return responseBodyMap;
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/src/test/java/TestDatalari/TestDataJsonPlaceholder.java:
--------------------------------------------------------------------------------
1 | package TestDatalari;
2 |
3 | import org.json.JSONObject;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | public class TestDataJsonPlaceholder {
9 |
10 | public static int basariliSorguStatusCode=200;
11 | public static String contentType="application/json; charset=utf-8";
12 | public static String headerConnection="keep-alive";
13 |
14 | public static JSONObject responseBodyOlustur22(){
15 |
16 | JSONObject expectedData= new JSONObject();
17 | expectedData.put("userId",3);
18 | expectedData.put("id",22);
19 | expectedData.put("title","dolor sint quo a velit explicabo quia nam");
20 | expectedData.put("body","eos qui et ipsum ipsam suscipit aut\nsed omnis non odio\nexpedita earum mollitia molestiae aut atque rem suscipit\nnam impedit esse");
21 |
22 | return expectedData;
23 | }
24 |
25 | public static JSONObject JsonBodyOlustur(int userId,int id,String title,String body){
26 | JSONObject expectedData= new JSONObject();
27 | expectedData.put("userId",userId);
28 | expectedData.put("id",id);
29 | expectedData.put("title",title);
30 | expectedData.put("body",body);
31 | return expectedData;
32 |
33 | }
34 |
35 | /*
36 | {
37 | "title":"Ahmet",
38 | "body":"Merhaba",
39 | "userId":10,
40 | "id":70
41 | }
42 | */
43 |
44 | public static Map bodyOlusturMap(){
45 | Map bodyMap= new HashMap<>();
46 | bodyMap.put("title","Ahmet");
47 | bodyMap.put("body","Merhaba");
48 | bodyMap.put("userId",10.0);
49 | bodyMap.put("id",70.0);
50 |
51 | return bodyMap;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C01_Get_ResponseBodyYazdirma.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.response.Response;
4 | import org.junit.Test;
5 |
6 | import static io.restassured.RestAssured.given;
7 |
8 | public class C01_Get_ResponseBodyYazdirma {
9 |
10 | @Test
11 | public void get01(){
12 |
13 | // https://restful-booker.herokuapp.com/booking/10 url’ine
14 | // bir GET request gonderdigimizde donen Response’u yazdirin.
15 |
16 | // 1- Request body ve end-point hazirlama
17 |
18 | String url="https://restful-booker.herokuapp.com/booking/10";
19 |
20 | // 2- Expected data hazirlama
21 |
22 | // 3- Request gonderip, donen response'i kaydetme
23 |
24 | Response response = given().when().get(url);
25 | response.prettyPrint();
26 |
27 | // 4- Assertion
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C02_Get_ResponseBilgilerininManuelTestEdilmesi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.response.Response;
4 | import org.junit.Test;
5 |
6 | import static io.restassured.RestAssured.given;
7 |
8 | public class C02_Get_ResponseBilgilerininManuelTestEdilmesi {
9 | @Test
10 | public void test01(){
11 |
12 | /*
13 | https://restful-booker.herokuapp.com/booking/10 url’ine
14 | bir GET request gonderdigimizde donen Response’un,
15 | status code’unun 200,
16 | ve content type’inin application/json; charset=utf-8,
17 | ve Server isimli Header’in degerinin Cowboy,
18 | ve status Line’in HTTP/1.1 200 OK
19 | ve response suresinin 5 sn’den kisa oldugunu manuel olarak test ediniz
20 | */
21 |
22 | // 1- gerekli body ve end point hazirla
23 | String url= "https://restful-booker.herokuapp.com/booking/10";
24 |
25 | // 2- expected body olustur
26 | // 3- request gonder ve donen response'i kaydet
27 |
28 | Response response= given().when().get(url);
29 |
30 | response.prettyPrint();
31 |
32 | System.out.println( "status code : "+response.getStatusCode()+
33 | "\nContent type : " + response.getContentType() +
34 | "\nServer Header degeri : " + response.getHeader("Server")+
35 | "\nStatus Line : " + response.getStatusLine()+
36 | "\nResponse suresi : " + response.getTime()+"ms");
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C03_Get_ResponseDegerleriniOtomasyonIleTestEtme.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.response.Response;
4 | import org.junit.Test;
5 |
6 | import static io.restassured.RestAssured.given;
7 |
8 | public class C03_Get_ResponseDegerleriniOtomasyonIleTestEtme {
9 |
10 | @Test
11 | public void test02(){
12 |
13 | /*
14 | https://restful-booker.herokuapp.com/booking/10 url’ine
15 | bir GET request gonderdigimizde donen Response’un,
16 | status code’unun 200,
17 | ve content type’inin application/json; charset=utf-8,
18 | ve Server isimli Header’in degerinin Cowboy,
19 | ve status Line’in HTTP/1.1 200 OK
20 | test edin
21 | */
22 |
23 | // 1- end point ve request body olustur
24 |
25 | String url= "https://restful-booker.herokuapp.com/booking/10";
26 |
27 | // 2- Expected body olustur
28 | // 3- Request gonderip, donen response'i kaydet
29 |
30 | Response response= given().when().get(url);
31 |
32 | // 4- Assertion
33 |
34 | response
35 | .then()
36 | .assertThat()
37 | .statusCode(200)
38 | .contentType("application/json; charset=utf-8")
39 | .header("Server", "Cowboy")
40 | .statusLine("HTTP/1.1 200 OK");
41 |
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C04_JsonObjesiOlusturma.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import org.json.JSONObject;
4 | import org.junit.Test;
5 |
6 | public class C04_JsonObjesiOlusturma {
7 |
8 | @Test
9 | public void test01(){
10 |
11 | /*
12 | {
13 | "title":"Ahmet",
14 | "body":"Merhaba",
15 | "userId":1
16 | }
17 |
18 | */
19 |
20 | JSONObject obj1= new JSONObject();
21 | obj1.put("title","Ahmet");
22 | obj1.put("body","Merhaba");
23 | obj1.put("userId",1);
24 |
25 | System.out.println(obj1);
26 | /*
27 | {
28 | "title":"Ahmet",
29 | "body":"Merhaba",
30 | "userId":1
31 | }
32 | */
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C05_JsonObjesiOlusturma.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import org.json.JSONObject;
4 | import org.junit.Test;
5 |
6 | public class C05_JsonObjesiOlusturma {
7 |
8 | @Test
9 | public void test01(){
10 |
11 | /*
12 |
13 | {
14 | "firstname":"Jim",
15 | "additionalneeds":"Breakfast",
16 | "bookingdates":{
17 | "checkin":"2018-01-01",
18 | "checkout":"2019-01-01"
19 | },
20 | "totalprice":111,
21 | "depositpaid":true,
22 | "lastname":"Brown"
23 | }
24 | */
25 |
26 | // Once inner Json objesini olusturalim
27 | JSONObject dateJsonObject= new JSONObject();
28 | dateJsonObject.put("checkin","2018-01-01");
29 | dateJsonObject.put("checkout","2019-01-01");
30 |
31 | // sonra outer json objesini olusturup, yeri geldiginde inner objeyi koyalim
32 |
33 | JSONObject requestBody= new JSONObject();
34 |
35 | requestBody.put("firstname","Jim");
36 | requestBody.put("additionalneeds","Breakfast");
37 | requestBody.put("bookingdates",dateJsonObject);
38 | requestBody.put("totalprice",111);
39 | requestBody.put("depositpaid",true);
40 | requestBody.put("lastname","Brown");
41 |
42 | System.out.println(requestBody);
43 |
44 | /*
45 | {
46 | "firstname":"Jim",
47 | "additionalneeds":"Breakfast",
48 | "bookingdates":{
49 | "checkin":"2018-01-01",
50 | "checkout":"2019-01-01"},
51 | "totalprice":111,
52 | "depositpaid":true,
53 | "lastname":"Brown"
54 | }
55 |
56 | */
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C06_Put_ResponseBilgileriAssertion.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.response.Response;
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 |
8 | import static io.restassured.RestAssured.given;
9 |
10 | public class C06_Put_ResponseBilgileriAssertion {
11 |
12 | @Test
13 | public void test01(){
14 |
15 | /*
16 | https://jsonplaceholder.typicode.com/posts/70 url’ine
17 | asagidaki Json formatindaki body ile bir PUT request gonderdigimizde
18 | {
19 | "title":"Ahmet",
20 | "body":"Merhaba",
21 | "userId":10,
22 | "id":70
23 | }
24 | donen Response’un,
25 | status code’unun 200,
26 | ve content type’inin application/json; charset=utf-8,
27 | ve Server isimli Header’in degerinin cloudflare,
28 | ve status Line’in HTTP/1.1 200 OK
29 |
30 | */
31 |
32 | // 1- end point ve request body hazirla
33 |
34 | String url= "https://jsonplaceholder.typicode.com/posts/70";
35 |
36 | JSONObject requestBody= new JSONObject();
37 | requestBody.put("title","Ahmet");
38 | requestBody.put("body","Merhaba");
39 | requestBody.put("userId",10);
40 | requestBody.put("id",70);
41 |
42 | // 2- expected body olustur
43 | // 3- request gonder ve donen response'i kaydet
44 |
45 | Response response = given()
46 | .contentType(ContentType.JSON)
47 | .when()
48 | .body(requestBody.toString())
49 | .put(url);
50 |
51 | // 4- Assertion
52 |
53 | response
54 | .then()
55 | .assertThat()
56 | .statusCode(200)
57 | .contentType("application/json; charset=utf-8")
58 | .header("Server","cloudflare")
59 | .statusLine("HTTP/1.1 200 OK");
60 |
61 |
62 |
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C07_Get_ResponseBodyTesti.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.junit.Test;
7 |
8 | import static io.restassured.RestAssured.given;
9 |
10 | public class C07_Get_ResponseBodyTesti {
11 |
12 | @Test
13 | public void test01(){
14 | /*
15 | https://jsonplaceholder.typicode.com/posts/44 url'ine bir GET request yolladigimizda
16 | donen Response’in
17 | status code'unun 200,
18 | ve content type'inin Aplication.JSON,
19 | ve response body'sinde bulunan userId'nin 5,
20 | ve response body'sinde bulunan title'in "optio dolor molestias sit"
21 | oldugunu test edin.
22 |
23 | */
24 |
25 | // 1- end point ve request body hazirla
26 | String url= "https://jsonplaceholder.typicode.com/posts/44";
27 |
28 | // 2- expected data hazirla
29 | // 3- request yollayip, donen response'i kaydet
30 |
31 | Response response= given().when().get(url);
32 |
33 | // 4- Assertion
34 |
35 | response
36 | .then()
37 | .assertThat()
38 | .statusCode(200)
39 | .contentType(ContentType.JSON)
40 | .body("userId",Matchers.equalTo(5))
41 | .body("title",Matchers.equalTo("optio dolor molestias sit"));
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C08_Post_ResponseBodyTesti.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.json.JSONObject;
7 | import org.junit.Test;
8 |
9 | import static io.restassured.RestAssured.given;
10 |
11 | public class C08_Post_ResponseBodyTesti {
12 |
13 | @Test
14 | public void test01(){
15 |
16 | /*
17 | https://jsonplaceholder.typicode.com/posts url’ine
18 | asagidaki body ile bir POST request gonderdigimizde
19 | {
20 | "title":"API",
21 | "body":"API ogrenmek ne guzel",
22 | "userId":10
23 | }
24 | donen Response’un,
25 | status code’unun 201,
26 | ve content type’inin application/json
27 | ve Response Body'sindeki,"title"'in "API" oldugunu
28 | "userId" degerinin 100'den kucuk oldugunu,
29 | "body" nin "API" kelimesi icerdigini
30 | test edin.
31 | */
32 |
33 | // 1- endpoint ve request body hazirla
34 | String url= "https://jsonplaceholder.typicode.com/posts";
35 |
36 | JSONObject requestBody= new JSONObject();
37 | requestBody.put("title","API");
38 | requestBody.put("body","API ogrenmek ne guzel");
39 | requestBody.put("userId",10);
40 |
41 | // 2- expected data olustur
42 | // 3- request gonderip, donen response'i kaydet
43 |
44 | Response response= given().contentType(ContentType.JSON)
45 | .when().body(requestBody.toString())
46 | .post(url);
47 |
48 | // 4- Assertion
49 | response
50 | .then()
51 | .assertThat()
52 | .statusCode(201)
53 | .contentType(ContentType.JSON)
54 | .body("title", Matchers.equalTo("API"))
55 | .body("userId",Matchers.lessThan(100))
56 | .body("body",Matchers.containsString("API"));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C09_Get_TestYaparkenTekrarlardanKurtulma.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.response.Response;
5 | import org.junit.Test;
6 |
7 | import static io.restassured.RestAssured.given;
8 | import static org.hamcrest.Matchers.*;
9 |
10 |
11 | public class C09_Get_TestYaparkenTekrarlardanKurtulma {
12 |
13 | @Test
14 | public void test01(){
15 | /*
16 | https://restful-booker.herokuapp.com/booking/10 url’ine
17 | bir GET request gonderdigimizde donen Response’un,
18 | status code’unun 200,
19 | ve content type’inin application-json,
20 | ve response body’sindeki
21 | "firstname“in,"Susan",
22 | ve "lastname“in, "Jackson",
23 | ve "totalprice“in,1000'den kucuk oldugu,
24 | ve "depositpaid“in,false,
25 | ve "additionalneeds“in,bos biralkilmadigini
26 | oldugunu test edin
27 | */
28 |
29 | // 1- endpoint ve request body hazirla
30 | String url = "https://restful-booker.herokuapp.com/booking/10";
31 |
32 | // 2- expected data olustur
33 | // 3- request gonderip, donen response'i kaydet
34 |
35 | Response response= given().when().get(url);
36 |
37 | // 4- Assertion
38 |
39 | /* ikinci yontem ile yaptigimizda bu testimizdeki yazilanlar degismesin diye
40 | yoruma aldim.
41 |
42 | response
43 | .then()
44 | .assertThat()
45 | .statusCode(200)
46 | .contentType(ContentType.JSON)
47 | .body("firstname", Matchers.equalTo("Eric"))
48 | .body("lastname",Matchers.equalTo("Jackson"))
49 | .body("totalprice",Matchers.lessThan(1000))
50 | .body("depositpaid",Matchers.equalTo(true))
51 | .body("additionalneeds",Matchers.notNullValue());
52 |
53 | */
54 |
55 | response
56 | .then()
57 | .assertThat()
58 | .statusCode(200)
59 | .contentType(ContentType.JSON)
60 | .body("firstname",equalTo("Eric"),
61 | "lastname", equalTo("Jackson"),
62 | "totalprice",lessThan(1000),
63 | "depositpaid",equalTo(true),
64 | "additionalneeds",notNullValue());
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C10_JsonPathKullanimi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import org.json.JSONArray;
4 | import org.json.JSONObject;
5 | import org.junit.Test;
6 |
7 | public class C10_JsonPathKullanimi {
8 |
9 | @Test
10 | public void method1(){
11 |
12 | JSONObject kisiBilgileriJsonObj= new JSONObject();
13 |
14 | JSONObject adresJsonObj= new JSONObject();
15 |
16 | JSONArray telefonBilgileriArr= new JSONArray();
17 | JSONObject cepTelJsonObj= new JSONObject();
18 | JSONObject evTelJsonObj= new JSONObject();
19 |
20 | adresJsonObj.put("streetAddress","naist street");
21 | adresJsonObj.put("city","Nara");
22 | adresJsonObj.put("postalCode","630-0192");
23 |
24 | cepTelJsonObj.put("type","iPhone");
25 | cepTelJsonObj.put("number","0123-4567-8888");
26 | evTelJsonObj.put("type","home");
27 | evTelJsonObj.put("number","0123-4567-8910");
28 | telefonBilgileriArr.put(cepTelJsonObj);
29 | telefonBilgileriArr.put(evTelJsonObj);
30 |
31 | kisiBilgileriJsonObj.put("firstName","John");
32 | kisiBilgileriJsonObj.put("lastName","Doe");
33 | kisiBilgileriJsonObj.put("age",26);
34 | kisiBilgileriJsonObj.put("address",adresJsonObj);
35 | kisiBilgileriJsonObj.put("phoneNumbers",telefonBilgileriArr);
36 |
37 | System.out.println(kisiBilgileriJsonObj);
38 |
39 | System.out.println("firstName : "+kisiBilgileriJsonObj.get("firstName"));
40 | System.out.println("lastName : "+kisiBilgileriJsonObj.get("lastName"));
41 |
42 | System.out.println("cadde: " +
43 | kisiBilgileriJsonObj.getJSONObject("address")
44 | .get("streetAddress"));
45 |
46 | System.out.println("city : " +
47 | kisiBilgileriJsonObj.getJSONObject("address")
48 | .get("city"));
49 |
50 | System.out.println("cep tel no : " +
51 | kisiBilgileriJsonObj.getJSONArray("phoneNumbers")
52 | .getJSONObject(0)
53 | .get("number"));
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C11_Post_JsonPathIleBodyTesti.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.json.JSONObject;
7 | import org.junit.Test;
8 |
9 | import static io.restassured.RestAssured.given;
10 | import static org.hamcrest.Matchers.equalTo;
11 |
12 | public class C11_Post_JsonPathIleBodyTesti {
13 |
14 | @Test
15 | public void test01(){
16 | /*
17 | https://restful-booker.herokuapp.com/booking url’ine
18 | asagidaki body'ye sahip bir POST request gonderdigimizde
19 | {
20 | "firstname" : "Ahmet",
21 | "lastname" : “Bulut",
22 | "totalprice" : 500,
23 | "depositpaid" : false,
24 | "bookingdates" : {
25 | "checkin" : "2023-01-10",
26 | "checkout" : "2023-01-20"},
27 | "additionalneeds" : "wi-fi"
28 | }
29 |
30 | donen Response’un,
31 | status code’unun 200,
32 | ve content type’inin application-json,
33 | ve response body’sindeki
34 | "firstname“in,"Ahmet",
35 | ve "lastname“in, "Bulut",
36 | ve "totalprice“in,500,
37 | ve "depositpaid“in,false,
38 | ve "checkin" tarihinin 2023-01-10
39 | ve "checkout" tarihinin 2023-01-20
40 | ve "additionalneeds“in,"wi-fi"
41 | oldugunu test edin
42 |
43 | */
44 |
45 | // 1- endpoint ve request body olustur
46 |
47 | String url= "https://restful-booker.herokuapp.com/booking";
48 |
49 | JSONObject requestBody= new JSONObject();
50 | JSONObject rezervasyonTarihleriJson= new JSONObject();
51 |
52 | rezervasyonTarihleriJson.put("checkin","2023-01-10");
53 | rezervasyonTarihleriJson.put("checkout","2023-01-20");
54 |
55 | requestBody.put("firstname","Ahmet");
56 | requestBody.put("lastname","Bulut");
57 | requestBody.put("totalprice",500);
58 | requestBody.put("depositpaid",false);
59 | requestBody.put("bookingdates",rezervasyonTarihleriJson);
60 | requestBody.put("additionalneeds","wi-fi");
61 |
62 | // 2- expected data olustur
63 | // 3- request gonder, donen response'i kaydet
64 |
65 | Response response = given().contentType(ContentType.JSON)
66 | .when().body(requestBody.toString())
67 | .post(url);
68 |
69 | // 4- Assertion
70 |
71 | response
72 | .then()
73 | .assertThat()
74 | .statusCode(200)
75 | .contentType(ContentType.JSON)
76 | .body("booking.firstname", equalTo("Ahmet"),
77 | "booking.lastname",equalTo("Bulut"),
78 | "booking.totalprice",equalTo(500),
79 | "booking.depositpaid",equalTo(false),
80 | "booking.bookingdates.checkin",equalTo("2023-01-10"),
81 | "booking.bookingdates.checkout",equalTo("2023-01-20"));
82 |
83 |
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C12_Get_ResponseBodyTestiListKullanimi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.junit.Test;
7 |
8 | import static io.restassured.RestAssured.given;
9 | import static org.hamcrest.Matchers.*;
10 |
11 | public class C12_Get_ResponseBodyTestiListKullanimi {
12 |
13 | @Test
14 | public void test01(){
15 | /*
16 | http://dummy.restapiexample.com/api/v1/employees url'ine
17 | bir GET request yolladigimizda
18 | donen Response'in
19 | status code'unun 200,
20 | ve content type'inin Aplication.JSON,
21 | ve response body'sindeki
22 | employees sayisinin 24
23 | ve employee'lerden birinin "Ashton Cox"
24 | ve girilen yaslar icinde 61,21 ve 35 degerinin oldugunu test edin.
25 | */
26 |
27 | //1- end point ve request body olustur
28 |
29 | String url = "http://dummy.restapiexample.com/api/v1/employees";
30 |
31 | //2- Expected data olustur
32 | //3- Request gonder ve donen response'i kaydet
33 | Response response= given()
34 | .when()
35 | .get(url);
36 |
37 | //4- Assertions
38 | response
39 | .then()
40 | .assertThat()
41 | .statusCode(200)
42 | .contentType(ContentType.JSON)
43 | .body("data.id", hasSize(24),
44 | "data.employee_name",hasItem("Ashton Cox"),
45 | "data.employee_age",hasItems(61,21,35));
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C13_Get_ExpectedDataOlusturma.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.path.json.JsonPath;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.json.JSONObject;
7 | import org.junit.Assert;
8 | import org.junit.Test;
9 |
10 | import static io.restassured.RestAssured.given;
11 | import static org.hamcrest.Matchers.equalTo;
12 |
13 | public class C13_Get_ExpectedDataOlusturma {
14 |
15 | @Test
16 | public void get01(){
17 | /*
18 | https://jsonplaceholder.typicode.com/posts/22 url'ine
19 | bir GET request yolladigimizda
20 | donen response body’sinin asagida verilen ile ayni oldugunu test ediniz
21 |
22 | Response body :
23 |
24 | {
25 | "userId":3,
26 | "id":22,
27 | "title":"dolor sint quo a velit explicabo quia nam",
28 | "body":"eos qui et ipsum ipsam suscipit aut\nsed omnis non odio\nexpedita earum mollitia molestiae aut atque rem suscipit\nnam impedit esse"
29 | }
30 | */
31 |
32 | // 1- endpoint ve request body hazirla
33 | String url= "https://jsonplaceholder.typicode.com/posts/22";
34 |
35 | // 2- expected data olustur
36 |
37 | JSONObject expectedData=new JSONObject();
38 | expectedData.put("userId",3);
39 | expectedData.put("id",22);
40 | expectedData.put("title","dolor sint quo a velit explicabo quia nam");
41 | expectedData.put("body","eos qui et ipsum ipsam suscipit aut\nsed omnis non odio\nexpedita earum mollitia molestiae aut atque rem suscipit\nnam impedit esse");
42 |
43 | // 3- request gonder ve donen response'i kaydet
44 |
45 | Response response = given().when().get(url);
46 |
47 |
48 | // 4- Assertion
49 |
50 | /* Bugune kadar yaptigimiz yontemle de testimizi yapabiliriz
51 | Ancak framework'umuzu gelistirmeye devam etmeliyiz
52 | response
53 | .then()
54 | .assertThat()
55 | .body("userId", equalTo(3),
56 | "id",equalTo(22),
57 | "title",equalTo("dolor sint quo a velit explicabo quia nam"));
58 |
59 | */
60 |
61 | JsonPath responseJsonPath= response.jsonPath();
62 |
63 | Assert.assertEquals(expectedData.get("id"),responseJsonPath.get("id"));
64 | Assert.assertEquals(expectedData.get("title"),responseJsonPath.get("title"));
65 | Assert.assertEquals(expectedData.get("body"),responseJsonPath.get("body"));
66 | Assert.assertEquals(expectedData.get("userId"),responseJsonPath.get("userId"));
67 |
68 |
69 |
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C14_Post_ExpectedDataVeJsonPathIleAssertion.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.path.json.JsonPath;
5 | import io.restassured.response.Response;
6 | import org.json.JSONObject;
7 | import org.junit.Assert;
8 | import org.junit.Test;
9 |
10 | import static io.restassured.RestAssured.given;
11 | import static org.junit.Assert.assertEquals;
12 |
13 | public class C14_Post_ExpectedDataVeJsonPathIleAssertion {
14 |
15 | @Test
16 | public void test01(){
17 | /*
18 | https://restful-booker.herokuapp.com/booking url’ine
19 | asagidaki body'ye sahip bir POST request gonderdigimizde
20 | donen response’un id haric asagidaki gibi oldugunu test edin.
21 |
22 | Request body
23 | {
24 | "firstname" : "Hasan",
25 | "lastname" : "Yagmur",
26 | "totalprice" : 500,
27 | "depositpaid" : false,
28 | "bookingdates" : {
29 | "checkin" : "2021-06-01",
30 | "checkout" : "2021-06-10"
31 | },
32 | "additionalneeds" : "wi-fi"
33 | }
34 |
35 | Expected Response Body
36 | {
37 | "bookingid":24,
38 | "booking":{
39 | "firstname":"Hasan",
40 | "lastname":"Yagmur",
41 | "totalprice":500,
42 | "depositpaid":false,
43 | "bookingdates":{
44 | "checkin":"2021-06-01",
45 | "checkout":"2021-06-10"
46 | },
47 | "additionalneeds":"wi-fi"
48 | }
49 | }
50 | */
51 |
52 | // 1- Endpoint ve request body olustur
53 |
54 | String url= "https://restful-booker.herokuapp.com/booking";
55 |
56 | JSONObject requestBody= new JSONObject();
57 | JSONObject rezTarihleriJson=new JSONObject();
58 |
59 | rezTarihleriJson.put("checkin","2021-06-01");
60 | rezTarihleriJson.put("checkout","2021-06-10");
61 |
62 | requestBody.put("firstname","Hasan");
63 | requestBody.put("lastname","Yagmur");
64 | requestBody.put("totalprice",500);
65 | requestBody.put("depositpaid",false);
66 | requestBody.put("bookingdates",rezTarihleriJson);
67 | requestBody.put("additionalneeds","wi-fi");
68 |
69 |
70 |
71 | // 2- expected data olustur
72 |
73 | JSONObject expectedData= new JSONObject();
74 | expectedData.put("bookingid",24);
75 | expectedData.put("booking",requestBody);
76 |
77 | // 3- request gonderip, donen response'i kaydet
78 |
79 | Response response= given().contentType(ContentType.JSON)
80 | .when().body(requestBody.toString())
81 | .post(url);
82 |
83 | // 4- Assertion
84 |
85 | JsonPath responseJsonPath= response.jsonPath();
86 | // ilk yazilan expected ====> olusturdugumuz JSonObject : expectedData
87 | // ikinci yazilan actual ===> response : responseJsonPath
88 | assertEquals(expectedData.getJSONObject("booking").get("firstname"),
89 | responseJsonPath.get("booking.firstname"));
90 | assertEquals(expectedData.getJSONObject("booking").get("lastname"),
91 | responseJsonPath.get("booking.lastname"));
92 | assertEquals(expectedData.getJSONObject("booking").get("totalprice"),
93 | responseJsonPath.get("booking.totalprice"));
94 | assertEquals(expectedData.getJSONObject("booking").get("depositpaid"),
95 | responseJsonPath.get("booking.depositpaid"));
96 | assertEquals(expectedData.getJSONObject("booking").get("additionalneeds"),
97 | responseJsonPath.get("booking.additionalneeds"));
98 |
99 | assertEquals(expectedData.getJSONObject("booking").getJSONObject("bookingdates").get("checkin"),
100 | responseJsonPath.get("booking.bookingdates.checkin"));
101 |
102 | assertEquals(expectedData.getJSONObject("booking").getJSONObject("bookingdates").get("checkout"),
103 | responseJsonPath.get("booking.bookingdates.checkout"));
104 |
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C15_Get_SoftAssertIleExpectedDataTesti.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.path.json.JsonPath;
4 | import io.restassured.response.Response;
5 | import org.json.JSONObject;
6 | import org.junit.Test;
7 | import org.testng.asserts.SoftAssert;
8 |
9 | import static io.restassured.RestAssured.given;
10 |
11 |
12 | public class C15_Get_SoftAssertIleExpectedDataTesti {
13 |
14 | @Test
15 | public void test01(){
16 | /*
17 | http://dummy.restapiexample.com/api/v1/employee/3 url’ine
18 | bir GET request gonderdigimizde
19 | donen response’un asagidaki gibi oldugunu test edin.
20 | Response Body
21 | {
22 | "status":"success",
23 | "data":{
24 | "id":3,
25 | "employee_name":"Ashton Cox",
26 | "employee_salary":86000,
27 | "employee_age":66,
28 | "profile_image":""
29 | },
30 | "message":"Successfully! Record has been fetched."
31 | }
32 | */
33 |
34 | // 1- end point ve request body olustur
35 |
36 | String url= "http://dummy.restapiexample.com/api/v1/employee/3";
37 |
38 | // 2- expected data olustur
39 |
40 | JSONObject expectedData= new JSONObject();
41 | JSONObject dataBilgileriJson=new JSONObject();
42 |
43 | dataBilgileriJson.put("id",3);
44 | dataBilgileriJson.put("employee_name","Ashton Cox");
45 | dataBilgileriJson.put("employee_salary",86000);
46 | dataBilgileriJson.put("employee_age",66);
47 | dataBilgileriJson.put("profile_image","");
48 |
49 | expectedData.put("status","success");
50 | expectedData.put("data",dataBilgileriJson);
51 | expectedData.put("message","Successfully! Record has been fetched.");
52 |
53 | // 3- Request gonder, donen response'i kaydet
54 |
55 | Response response= given().when().get(url);
56 |
57 |
58 | // 4- Assertion
59 |
60 | // oncelikle response uzerindeki bilgileri kolay almak icin
61 | // JSonPath'e cast edelim
62 |
63 | JsonPath responseJsonPath= response.jsonPath();
64 |
65 | // Assertion'lari soft assert ile yapalim
66 |
67 | SoftAssert softAssert=new SoftAssert();
68 |
69 | softAssert.assertEquals(responseJsonPath.get("status"),expectedData.get("status"));
70 | softAssert.assertEquals(responseJsonPath.get("message"),expectedData.get("message"));
71 | softAssert.assertEquals(responseJsonPath.get("data.id"),
72 | expectedData.getJSONObject("data").get("id"));
73 | softAssert.assertEquals(responseJsonPath.get("data.employee_name"),
74 | expectedData.getJSONObject("data").get("employee_name"));
75 | softAssert.assertEquals(responseJsonPath.get("data.employee_salary"),
76 | expectedData.getJSONObject("data").get("employee_salary"));
77 | softAssert.assertEquals(responseJsonPath.get("data.employee_age"),
78 | expectedData.getJSONObject("data").get("employee_age"));
79 | softAssert.assertEquals(responseJsonPath.get("data.profile_image"),
80 | expectedData.getJSONObject("data").get("profile_image"));
81 | softAssert.assertAll();
82 |
83 |
84 |
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C16_Put_SoftAssertIleExpectedDataTesti.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.http.ContentType;
4 | import io.restassured.path.json.JsonPath;
5 | import io.restassured.response.Response;
6 | import org.json.JSONObject;
7 | import org.junit.Test;
8 | import org.testng.asserts.SoftAssert;
9 |
10 | import static io.restassured.RestAssured.given;
11 |
12 | public class C16_Put_SoftAssertIleExpectedDataTesti {
13 |
14 | @Test
15 | public void test01(){
16 | /*
17 | http://dummy.restapiexample.com/api/v1/update/21 url’ine
18 | asagidaki body’ye sahip bir PUT request gonderdigimizde
19 | donen response’un asagidaki gibi oldugunu test edin.
20 | Request Body
21 | {
22 | "status": "success",
23 | "data": {
24 | "name": "Ahmet",
25 | "salary": "1230",
26 | "age": "44",
27 | "id": 40
28 | }
29 | }
30 | Response Body
31 | {
32 | "status": "success",
33 | "data": {
34 | "status": "success",
35 | "data": {
36 | "name": "Ahmet",
37 | "salary": "1230",
38 | "age": "44",
39 | "id": 40
40 | }
41 | },
42 | "message": "Successfully! Record has been updated."
43 | }
44 |
45 | */
46 |
47 | // 1- endpoint ve request body olustur
48 |
49 | String url= "http://dummy.restapiexample.com/api/v1/update/21";
50 |
51 | JSONObject requestBody= new JSONObject();
52 | JSONObject dataBilgileriJson= new JSONObject();
53 |
54 | dataBilgileriJson.put("name","Ahmet");
55 | dataBilgileriJson.put("salary","1230");
56 | dataBilgileriJson.put("age","44");
57 | dataBilgileriJson.put("id",40);
58 |
59 | requestBody.put("status","success");
60 | requestBody.put("data",dataBilgileriJson);
61 |
62 |
63 |
64 | // 2- Expected data olustur
65 |
66 | JSONObject expectedData= new JSONObject();
67 | expectedData.put("status","success");
68 | expectedData.put("data",requestBody);
69 | expectedData.put("message","Successfully! Record has been updated.");
70 |
71 |
72 | // 3- request gonder ve donen response'i kaydet
73 |
74 | Response response= given().contentType(ContentType.JSON)
75 | .when().body(requestBody.toString())
76 | .put(url);
77 |
78 | // 4- Assertions (softassert)
79 | JsonPath responseJsonPath=response.jsonPath();
80 |
81 | SoftAssert softAssert= new SoftAssert();
82 |
83 | softAssert.assertEquals(responseJsonPath.get("status"),expectedData.get("status"));
84 | softAssert.assertEquals(responseJsonPath.get("message"),expectedData.get("message"));
85 | softAssert.assertEquals(responseJsonPath.get("data.status"),
86 | expectedData.getJSONObject("data").get("status") );
87 | softAssert.assertEquals(responseJsonPath.get("data.data.name"),
88 | expectedData.getJSONObject("data").getJSONObject("data").get("name"));
89 | softAssert.assertEquals(responseJsonPath.get("data.data.id"),
90 | expectedData.getJSONObject("data").getJSONObject("data").get("id"));
91 | softAssert.assertEquals(responseJsonPath.get("data.data.salary"),
92 | expectedData.getJSONObject("data").getJSONObject("data").get("salary"));
93 | softAssert.assertEquals(responseJsonPath.get("data.data.age"),
94 | expectedData.getJSONObject("data").getJSONObject("data").get("age"));
95 |
96 | softAssert.assertAll();
97 |
98 |
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C17_BaseUrlDummyRestapi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlJsonPlaceholder;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.junit.Test;
7 |
8 | import static io.restassured.RestAssured.given;
9 |
10 | public class C17_BaseUrlDummyRestapi extends BaseUrlJsonPlaceholder {
11 |
12 |
13 | //Class icinde 3 Test metodu olusturun ve asagidaki testleri yapin
14 |
15 | //3- https://jsonplaceholder.typicode.com/posts/50 endpointine
16 | // bir DELETE request gonderdigimizde donen response’un
17 | // status code’unun 200 oldugunu ve response body’sinin null oldugunu test edin
18 |
19 | @Test
20 | public void test01(){
21 | //1- https://jsonplaceholder.typicode.com/posts endpointine
22 | // bir GET request gonderdigimizde donen response’un
23 | // status code’unun 200 oldugunu ve Response’ta 100 kayit oldugunu test edin
24 |
25 | // 1- endpoint ve request body olustur
26 |
27 | specJsonPlaceholder.pathParam("pp1","posts");
28 |
29 | // 2- expected data olustur
30 | // 3- request gonder ve donen response'i kaydet
31 |
32 | Response response= given()
33 | .when().spec(specJsonPlaceholder)
34 | .get("/{pp1}");
35 |
36 | response
37 | .then()
38 | .assertThat()
39 | .statusCode(200)
40 | .body("title", Matchers.hasSize(100));
41 | }
42 |
43 | @Test
44 | public void test02(){
45 | //2- https://jsonplaceholder.typicode.com/posts/44 endpointine
46 | // bir GET request gonderdigimizde donen response’un
47 | // status code’unun 200 oldugunu
48 | // ve “title” degerinin “optio dolor molestias sit” oldugunu test edin
49 |
50 | // 1- endpoint ve request body olustur
51 | specJsonPlaceholder.pathParams("pp1","posts","pp2",44);
52 |
53 | // 2- expected data olustur
54 | // 3- request gonder ve donen response'i kaydet
55 |
56 | Response response= given()
57 | .when().spec(specJsonPlaceholder)
58 | .get("/{pp1}/{pp2}");
59 |
60 | response
61 | .then()
62 | .assertThat()
63 | .statusCode(200)
64 | .body("title",Matchers.equalTo("optio dolor molestias sit"));
65 |
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C18_BaseUrlDummyRestapi2.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlJsonPlaceholder;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.junit.Test;
7 |
8 | import static io.restassured.RestAssured.given;
9 |
10 | public class C18_BaseUrlDummyRestapi2 extends BaseUrlJsonPlaceholder {
11 |
12 | @Test
13 | public void test01(){
14 | //3- https://jsonplaceholder.typicode.com/posts/50 endpointine
15 | // bir DELETE request gonderdigimizde donen response’un
16 | // status code’unun 200 oldugunu
17 | // ve response body’sinin null oldugunu test edin
18 |
19 |
20 | // 1- endpoint ve request body olustur
21 |
22 | specJsonPlaceholder.pathParams("pp1","posts","pp2",50);
23 |
24 |
25 | // 2- expected data olustur
26 | // 3- request gonder ve donen response'i kaydet
27 |
28 | Response response= given()
29 | .when().spec(specJsonPlaceholder)
30 | .delete("/{pp1}/{pp2}");
31 |
32 |
33 | // 4- Assertion
34 |
35 | response
36 | .then()
37 | .assertThat()
38 | .statusCode(200)
39 | .body("title",Matchers.nullValue());
40 |
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C19_BaseUrlHerokuapp.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlHerokuapp;
4 | import io.restassured.path.json.JsonPath;
5 | import io.restassured.response.Response;
6 | import org.hamcrest.Matchers;
7 | import org.junit.Test;
8 |
9 | import static io.restassured.RestAssured.given;
10 |
11 | public class C19_BaseUrlHerokuapp extends BaseUrlHerokuapp {
12 |
13 | //1- https://restful-booker.herokuapp.com/booking endpointine
14 | // bir GET request gonderdigimizde
15 | // donen response’un
16 | // status code’unun 200 oldugunu
17 | // ve Response’ta 12 booking oldugunu test edin
18 |
19 | @Test
20 | public void test01(){
21 |
22 | // 1- endpoint ve request body olustur
23 |
24 | specHerokuapp.pathParam("pp1","booking");
25 |
26 | // 2- expected data olustur
27 |
28 | // 3- request gonder ve donen response'i kaydet
29 |
30 | Response response=given()
31 | .when().spec(specHerokuapp)
32 | .get("/{pp1}");
33 |
34 | // 4- Assertion
35 |
36 | JsonPath responseJsonpath=response.jsonPath();
37 | System.out.println(responseJsonpath.getList("bookingid").size());
38 |
39 | response
40 | .then()
41 | .assertThat()
42 | .statusCode(200)
43 | .body("bookingid", Matchers.hasSize(2983));
44 |
45 |
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C20_BaseUrlHerokuapp2.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlHerokuapp;
4 | import io.restassured.http.ContentType;
5 | import io.restassured.response.Response;
6 | import org.hamcrest.Matchers;
7 | import org.json.JSONObject;
8 | import org.junit.Test;
9 |
10 | import static io.restassured.RestAssured.given;
11 |
12 | public class C20_BaseUrlHerokuapp2 extends BaseUrlHerokuapp {
13 |
14 |
15 | @Test
16 | public void test01() {
17 | /*
18 | 2- https://restful-booker.herokuapp.com/booking endpointine
19 | asagidaki body’ye sahip bir POST request gonderdigimizde
20 | donen response’un
21 | status code’unun 200 oldugunu
22 | ve “firstname” degerinin “Ahmet” oldugunu test edin
23 |
24 | {
25 | "firstname" : "Ahmet",
26 | "lastname" : “Bulut",
27 | "totalprice" : 500,
28 | "depositpaid" : false,
29 | "bookingdates" : {
30 | "checkin" : "2021-06-01",
31 | "checkout" : "2021-06-10"
32 | },
33 | "additionalneeds" : "wi-fi" }
34 | */
35 |
36 | // 1- endpoint ve request body olustur
37 |
38 | specHerokuapp.pathParam("pp1","booking");
39 |
40 | JSONObject requestBody= new JSONObject();
41 | JSONObject rezervasyonTarihleriJson= new JSONObject();
42 |
43 | rezervasyonTarihleriJson.put("checkin","2021-06-01");
44 | rezervasyonTarihleriJson.put("checkout","2021-06-10");
45 |
46 | requestBody.put("firstname","Ahmet");
47 | requestBody.put("lastname","Bulut");
48 | requestBody.put("totalprice",500);
49 | requestBody.put("depositpaid",false);
50 | requestBody.put("bookingdates",rezervasyonTarihleriJson);
51 | requestBody.put("additionalneeds","wi-fi");
52 |
53 | // 2- expected data olustur
54 | // 3- request gonder ve donen response'i kaydet
55 |
56 | Response response= given().contentType(ContentType.JSON)
57 | .when().spec(specHerokuapp).body(requestBody.toString())
58 | .post("/{pp1}");
59 |
60 | // 4- Assertion
61 |
62 | response
63 | .then()
64 | .assertThat()
65 | .statusCode(200)
66 | .body("booking.firstname", Matchers.equalTo("Ahmet"));
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C21_BaseUrlHerokuappQueryParam.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 |
4 | import baseUrl.BaseUrlHerokuapp;
5 | import io.restassured.response.Response;
6 | import org.hamcrest.Matchers;
7 | import org.junit.Test;
8 |
9 | import static io.restassured.RestAssured.given;
10 |
11 | public class C21_BaseUrlHerokuappQueryParam extends BaseUrlHerokuapp {
12 |
13 | @Test
14 | public void test01() {
15 | /*
16 |
17 | "https://restful-booker.herokuapp.com"/booking endpointine
18 | gerekli Query parametrelerini yazarak
19 | “firstname” degeri “Susan” olan rezervasyon oldugunu
20 | test edecek bir GET request gonderdigimizde,
21 | donen response’un
22 | status code’unun 200 oldugunu
23 | ve “Susan” ismine sahip 2 booking oldugunu test edin
24 |
25 | */
26 |
27 | // 1- endpoint ve request body olustur
28 |
29 | specHerokuapp
30 | .pathParam("pp1","booking")
31 | .queryParam("firstname","Susan");
32 | // 2- expected data olustur
33 | // 3- request gonder ve donen response'i kaydet
34 |
35 | Response response= given()
36 | .when().spec(specHerokuapp)
37 | .get("/{pp1}");
38 |
39 | response.prettyPrint();
40 | // 4- Assertion
41 |
42 | response
43 | .then()
44 | .assertThat()
45 | .statusCode(200)
46 | .body("bookingid", Matchers.hasSize(2));
47 |
48 |
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C22_BaseUrlHerokuappQueryParam.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlHerokuapp;
4 | import io.restassured.response.Response;
5 | import org.hamcrest.Matchers;
6 | import org.junit.Test;
7 |
8 | import static io.restassured.RestAssured.given;
9 |
10 | public class C22_BaseUrlHerokuappQueryParam extends BaseUrlHerokuapp {
11 | @Test
12 | public void test01() {
13 | /*
14 |
15 | https://restful-booker.herokuapp.com/booking endpointine
16 | gerekli Query parametrelerini yazarak
17 | “firstname” degeri “Susan”
18 | ve “lastname” degeri “Ericson” olan
19 | rezervasyon oldugunu test edecek bir GET request gonderdigimizde,
20 | donen response’un
21 | status code’unun 200 oldugunu
22 | ve “Eric Jones” ismine sahip en az bir booking oldugunu test edin
23 | */
24 |
25 | // 1- endpoint ve request body olustur
26 |
27 | specHerokuapp
28 | .pathParam("pp1","booking")
29 | .queryParams("firstname","Susan","lastname","Jones");
30 |
31 |
32 | // 2- expected data olustur
33 | // 3- request gonder ve donen response'i kaydet
34 |
35 | Response response= given()
36 | .when().spec(specHerokuapp)
37 | .get("/{pp1}");
38 |
39 |
40 | // 4- Assertion
41 |
42 | response
43 | .then()
44 | .assertThat()
45 | .statusCode(200)
46 | .body("bookingid", Matchers.hasSize(1));
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C23_Get_TestDataClassKullanimi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataJsonPlaceholder;
4 | import baseUrl.BaseUrlJsonPlaceholder;
5 | import io.restassured.path.json.JsonPath;
6 | import io.restassured.response.Response;
7 | import org.json.JSONObject;
8 | import org.junit.Assert;
9 | import org.junit.Test;
10 |
11 | import static io.restassured.RestAssured.given;
12 |
13 | public class C23_Get_TestDataClassKullanimi extends BaseUrlJsonPlaceholder {
14 |
15 | @Test
16 | public void test01(){
17 | /*
18 | https://jsonplaceholder.typicode.com/posts/22 url'ine
19 | bir GET request yolladigimizda
20 | donen response’in
21 | status kodunun 200
22 | ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
23 |
24 | Response body :
25 | {
26 | "userId":3,
27 | "id":22,
28 | "title":"dolor sint quo a velit explicabo quia nam",
29 | "body":"eos qui et ipsum ipsam suscipit aut\nsed omnis non odio\nexpedita ear
30 | um mollitia molestiae aut atque rem suscipit\nnam impedit esse"
31 | }
32 | */
33 |
34 | // 1- endpoint ve request body olustur
35 |
36 | specJsonPlaceholder.pathParams("pp1","posts","pp2","22");
37 |
38 | // 2- expected data olustur
39 |
40 | JSONObject expectedData= TestDataJsonPlaceholder.responseBodyOlustur22();
41 |
42 | // 3- request gonder ve donen response'i kaydet
43 |
44 | Response response= given().spec(specJsonPlaceholder)
45 | .when()
46 | .get("{pp1}/{pp2}");
47 |
48 | JsonPath responseJsonpath= response.jsonPath();
49 | // 4- Assertion
50 | // status kodunun 200
51 | // ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
52 |
53 | Assert.assertEquals(TestDataJsonPlaceholder.basariliSorguStatusCode,response.statusCode());
54 | Assert.assertEquals(expectedData.getInt("userId"),responseJsonpath.getInt("userId"));
55 | Assert.assertEquals(expectedData.getInt("id"),responseJsonpath.getInt("id"));
56 | Assert.assertEquals(expectedData.getString("title"),responseJsonpath.getString("title"));
57 | Assert.assertEquals(expectedData.getString("body"),responseJsonpath.getString("body"));
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C24_Get_TestDataClassKullanimiDinamik.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataJsonPlaceholder;
4 | import baseUrl.BaseUrlJsonPlaceholder;
5 | import io.restassured.path.json.JsonPath;
6 | import io.restassured.response.Response;
7 | import org.json.JSONObject;
8 | import org.junit.Assert;
9 | import org.junit.Test;
10 |
11 | import static io.restassured.RestAssured.given;
12 | import static org.junit.Assert.assertEquals;
13 |
14 | public class C24_Get_TestDataClassKullanimiDinamik extends BaseUrlJsonPlaceholder {
15 |
16 | @Test
17 | public void test01(){
18 | /*
19 | https://jsonplaceholder.typicode.com/posts/40 url'ine
20 | bir GET request yolladigimizda
21 | donen response’in
22 | status kodunun 200
23 | ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
24 |
25 | Response body :
26 | {
27 | "userId":4,
28 | "id":40,
29 | "title":"enim quo cumque",
30 | "body":"ut voluptatum aliquid illo tenetur nemo sequi quo facilis\nipsum rem optio mollitia quas\nvoluptatem eum voluptas qui\nunde omnis voluptatem iure quasi maxime voluptas nam"
31 | }
32 | */
33 |
34 | // 1- endpoint ve request body olustur
35 |
36 | specJsonPlaceholder.pathParams("pp1","posts","pp2","40");
37 |
38 | // 2- expected data olustur
39 |
40 | JSONObject expectedData= TestDataJsonPlaceholder.JsonBodyOlustur(4,40,"enim quo cumque","ut voluptatum aliquid illo tenetur nemo sequi quo facilis\nipsum rem optio mollitia quas\nvoluptatem eum voluptas qui\nunde omnis voluptatem iure quasi maxime voluptas nam");
41 |
42 |
43 | // 3- request gonder ve donen response'i kaydet
44 |
45 | Response response= given().spec(specJsonPlaceholder)
46 | .when()
47 | .get("{pp1}/{pp2}");
48 |
49 | // 4- Assertion
50 | // status kodunun 200
51 | // ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
52 |
53 | JsonPath responseJsonpath= response.jsonPath();
54 |
55 | assertEquals(TestDataJsonPlaceholder.basariliSorguStatusCode,response.statusCode());
56 | assertEquals(expectedData.getInt("userId"),responseJsonpath.getInt("userId"));
57 | assertEquals(expectedData.getInt("id"),responseJsonpath.getInt("id"));
58 | assertEquals(expectedData.getString("title"),responseJsonpath.getString("title"));
59 | assertEquals(expectedData.getString("body"),responseJsonpath.getString("body"));
60 |
61 |
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C25_Put_TestDataClassKullanimi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataJsonPlaceholder;
4 | import baseUrl.BaseUrlJsonPlaceholder;
5 | import io.restassured.http.ContentType;
6 | import io.restassured.path.json.JsonPath;
7 | import io.restassured.response.Response;
8 | import org.json.JSONObject;
9 | import org.junit.Assert;
10 | import org.junit.Test;
11 |
12 | import java.lang.module.ResolutionException;
13 |
14 | import static io.restassured.RestAssured.given;
15 | import static org.junit.Assert.assertEquals;
16 |
17 | public class C25_Put_TestDataClassKullanimi extends BaseUrlJsonPlaceholder {
18 | @Test
19 | public void test01(){
20 | /*
21 | https://jsonplaceholder.typicode.com/posts/70 url'ine
22 | asagidaki body’e sahip bir PUT request yolladigimizda
23 | donen response’in
24 | status kodunun 200,
25 | content type’inin “application/json; charset=utf-8”,
26 | Connection header degerinin “keep-alive”
27 | ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
28 | Request Body
29 | {
30 | "title":"Ahmet",
31 | "body":"Merhaba",
32 | "userId":10,
33 | "id":70
34 | }
35 | Response body (Expected Data) :
36 | {
37 | "title":"Ahmet",
38 | "body":"Merhaba",
39 | "userId":10,
40 | "id":70
41 | }
42 | */
43 |
44 | // 1- endpoint ve request body olustur
45 |
46 | specJsonPlaceholder.pathParams("pp1","posts","pp2",70);
47 |
48 | JSONObject requestBody = TestDataJsonPlaceholder.JsonBodyOlustur(10,70,"Ahmet","Merhaba");
49 |
50 | // 2- expected data olustur
51 |
52 | JSONObject expectedData= TestDataJsonPlaceholder.JsonBodyOlustur(10,70,"Ahmet","Merhaba");
53 |
54 | // 3- request gonder ve donen response'i kaydet
55 |
56 | Response response= given().spec(specJsonPlaceholder)
57 | .when().body(requestBody.toString()).contentType(ContentType.JSON)
58 | .put("{pp1}/{pp2}");
59 |
60 |
61 | // 4- Assertion
62 |
63 | JsonPath responseJP= response.jsonPath();
64 |
65 | // status kodunun 200,
66 | assertEquals(TestDataJsonPlaceholder.basariliSorguStatusCode,response.statusCode());
67 | // content type’inin “application/json; charset=utf-8”,
68 | assertEquals(TestDataJsonPlaceholder.contentType,response.contentType());
69 |
70 | // Connection header degerinin “keep-alive”
71 |
72 | assertEquals(TestDataJsonPlaceholder.headerConnection,response.header("Connection"));
73 |
74 | // ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
75 |
76 | assertEquals(expectedData.getInt("id"),responseJP.getInt("id"));
77 | assertEquals(expectedData.getInt("userId"),responseJP.getInt("userId"));
78 | assertEquals(expectedData.getString("title"),responseJP.getString("title"));
79 | assertEquals(expectedData.getString("body"),responseJP.getString("body"));
80 |
81 |
82 |
83 |
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C26_Get_TestDataClassKullanimi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataDummyExample;
4 | import baseUrl.BaseUrlDummyExample;
5 | import io.restassured.path.json.JsonPath;
6 | import io.restassured.response.Response;
7 | import org.json.JSONObject;
8 | import org.junit.Assert;
9 | import org.junit.Test;
10 |
11 | import static io.restassured.RestAssured.given;
12 | import static org.junit.Assert.assertEquals;
13 |
14 | public class C26_Get_TestDataClassKullanimi extends BaseUrlDummyExample {
15 |
16 | @Test
17 | public void test01(){
18 | /*
19 | http://dummy.restapiexample.com/api/v1/employee/3 url’ine
20 | bir GET request gonderdigimizde
21 | donen response’un status code’unun 200,
22 | content Type’inin application/json
23 | ve body’sinin asagidaki gibi oldugunu test edin.
24 |
25 | Expected Response Body
26 | {
27 | "status":"success",
28 | "data":{
29 | "id":3,
30 | "employee_name":"Ashton Cox",
31 | "employee_salary":86000,
32 | "employee_age":66,
33 | "profile_image":""
34 | },
35 | "message":"Successfully! Record has been fetched."
36 | }
37 | */
38 |
39 | // 1- endpoint ve request body olustur
40 | specDummyExample.pathParams("pp1","employee","pp2","3");
41 |
42 | // 2- expected data olustur
43 |
44 | JSONObject expectedData= TestDataDummyExample
45 | .jsonResponseBodyOlustur(3,
46 | "Ashton Cox",
47 | 86000,
48 | 66,
49 | "");
50 |
51 | // 3- request gonder ve donen response'i kaydet
52 | Response response= given().spec(specDummyExample).
53 | when().
54 | get("{pp1}/{pp2}");
55 |
56 | // 4- assertion
57 | // Expected data : JSONObject
58 | // response : JsonPath
59 |
60 | JsonPath responseJP= response.jsonPath();
61 | //donen response’un status code’unun 200,
62 | assertEquals(TestDataDummyExample.basariliSorguStatusCode,response.statusCode());
63 | //content Type’inin application/json
64 | assertEquals(TestDataDummyExample.contentType,response.contentType());
65 | //ve body’sinin asagidaki gibi oldugunu test edin.
66 |
67 | assertEquals(expectedData.getJSONObject("data").getString("profile_image"),
68 | responseJP.getString("data.profile_image"));
69 |
70 | assertEquals(expectedData.getJSONObject("data").getString("employee_name"),
71 | responseJP.getString("data.employee_name"));
72 |
73 | assertEquals(expectedData.getJSONObject("data").getInt("employee_salary"),
74 | responseJP.getInt("data.employee_salary"));
75 |
76 | assertEquals(expectedData.getJSONObject("data").getInt("id"),
77 | responseJP.getInt("data.id"));
78 |
79 | assertEquals(expectedData.getJSONObject("data").getInt("employee_age"),
80 | responseJP.getInt("data.employee_age"));
81 |
82 | assertEquals(expectedData.getString("message"),responseJP.getString("message"));
83 |
84 | assertEquals(expectedData.getString("status"),responseJP.getString("status"));
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C27_Post_TestDataClassKullanimi.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataHerokuapp;
4 | import baseUrl.BaseUrlHerokuapp;
5 | import io.restassured.http.ContentType;
6 | import io.restassured.path.json.JsonPath;
7 | import io.restassured.response.Response;
8 | import org.json.JSONObject;
9 | import org.junit.Assert;
10 | import org.junit.Test;
11 |
12 | import static io.restassured.RestAssured.given;
13 | import static org.junit.Assert.assertEquals;
14 |
15 | public class C27_Post_TestDataClassKullanimi extends BaseUrlHerokuapp {
16 | @Test
17 | public void test01(){
18 | /*
19 | https://restful-booker.herokuapp.com/booking url’ine
20 | asagidaki body'ye sahip bir POST request gonderdigimizde
21 | donen response’un id haric asagidaki gibi oldugunu test edin.
22 | Request body
23 | {
24 | "firstname" : "Ahmet",
25 | "lastname" : “Bulut",
26 | "totalprice" : 500,
27 | "depositpaid" : false,
28 | "bookingdates" : {
29 | "checkin" : "2021-06-01",
30 | "checkout" : "2021-06-10"
31 | },
32 | "additionalneeds" : "wi-fi"
33 | }
34 | Expected response body
35 | {
36 | "bookingid":24,
37 | "booking":{
38 | "firstname":"Ahmet",
39 | "lastname":"Bulut",
40 | "totalprice":500,
41 | "depositpaid":false,
42 | "bookingdates":{
43 | "checkin":"2021-06-01",
44 | "checkout":"2021-06-10"
45 | },
46 | "additionalneeds":"wi-fi"
47 | }
48 | }
49 | */
50 |
51 | // 1- endpoint ve request body olustur
52 |
53 | specHerokuapp.pathParam("pp1","booking");
54 | JSONObject requestBody= TestDataHerokuapp.jsonRequestBodyOlustur();
55 |
56 |
57 | // 2- Soruda varsa expected data olustur
58 |
59 | JSONObject expectedData= TestDataHerokuapp.jsonResponseBodyOlustur();
60 |
61 | // 3- Request gonder donen response'i kaydet
62 |
63 | Response response= given().spec(specHerokuapp).contentType(ContentType.JSON)
64 | .when().body(requestBody.toString())
65 | .post("{pp1}");
66 |
67 | // Assertion
68 |
69 | JsonPath responseJP= response.jsonPath();
70 |
71 | assertEquals(expectedData.getJSONObject("booking").getString("firstname"),
72 | responseJP.getString("booking.firstname"));
73 |
74 | assertEquals(expectedData.getJSONObject("booking").getString("lastname"),
75 | responseJP.getString("booking.lastname"));
76 |
77 | assertEquals(expectedData.getJSONObject("booking").getInt("totalprice"),
78 | responseJP.getInt("booking.totalprice"));
79 |
80 | assertEquals(expectedData.getJSONObject("booking").getBoolean("depositpaid"),
81 | responseJP.getBoolean("booking.depositpaid"));
82 |
83 | assertEquals(expectedData.getJSONObject("booking").getString("additionalneeds"),
84 | responseJP.getString("booking.additionalneeds"));
85 |
86 | assertEquals(expectedData.getJSONObject("booking").getJSONObject("bookingdates").getString("checkin")
87 | ,responseJP.getString("booking.bookingdates.checkin"));
88 |
89 | assertEquals(expectedData.getJSONObject("booking").getJSONObject("bookingdates").getString("checkout")
90 | ,responseJP.getString("booking.bookingdates.checkout"));
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C28_Put_DeSerialization.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataHerokuapp;
4 | import TestDatalari.TestDataJsonPlaceholder;
5 | import baseUrl.BaseUrlJsonPlaceholder;
6 | import io.restassured.http.ContentType;
7 | import io.restassured.response.Response;
8 | import org.junit.Assert;
9 | import org.junit.Test;
10 |
11 | import java.util.HashMap;
12 | import java.util.Map;
13 |
14 | import static io.restassured.RestAssured.given;
15 | import static org.junit.Assert.assertEquals;
16 |
17 | public class C28_Put_DeSerialization extends BaseUrlJsonPlaceholder {
18 |
19 | /*
20 | https://jsonplaceholder.typicode.com/posts/70 url'ine
21 | asagidaki body’e sahip bir PUT request yolladigimizda
22 | donen response’in response body’sinin asagida verilen ile ayni oldugunu test ediniz
23 |
24 | Request Body
25 |
26 | {
27 | "title":"Ahmet",
28 | "body":"Merhaba",
29 | "userId":10,
30 | "id":70
31 | }
32 |
33 | Expected Response Body:
34 |
35 | {
36 | "title":"Ahmet",
37 | "body":"Merhaba",
38 | "userId":10,
39 | "id":70
40 | }
41 | */
42 |
43 | @Test
44 | public void test01(){
45 | // 1- endpoint ve request body olustur
46 |
47 | specJsonPlaceholder.pathParams("pp1","posts","pp2",70);
48 |
49 | // Request body'sini Map olarak olusturalim
50 | Map requestBodyMap= TestDataJsonPlaceholder.bodyOlusturMap();
51 |
52 |
53 | // 2- Soruda varsa expected data olustur
54 |
55 | Map expectedData= TestDataJsonPlaceholder.bodyOlusturMap();
56 |
57 | // 3- Request gonder donen response'i kaydet
58 |
59 | Response response= given().spec(specJsonPlaceholder).contentType(ContentType.JSON)
60 | .when().body(requestBodyMap)
61 | .put("{pp1}/{pp2}");
62 |
63 | // 4- Assertion
64 | // expected Response body <=====> response
65 | // Map Response
66 |
67 | // Assertion yapabilmemiz icin response'i Map'e cevirmemiz gerekir (De-Serialization)
68 |
69 | Map responseMap= response.as(HashMap.class);
70 |
71 | // expectedData (Map) <===> responseMap(Map)
72 |
73 | assertEquals(expectedData.get("title"),responseMap.get("title"));
74 | assertEquals(expectedData.get("body"),responseMap.get("body"));
75 | assertEquals(expectedData.get("id"),responseMap.get("id"));
76 | assertEquals(expectedData.get("userId"),responseMap.get("userId"));
77 |
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C29_Get_DeSerialization.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataDummyExample;
4 | import baseUrl.BaseUrlDummyExample;
5 | import io.restassured.response.Response;
6 | import org.junit.Assert;
7 | import org.junit.Test;
8 |
9 | import java.util.HashMap;
10 | import java.util.Map;
11 |
12 | import static io.restassured.RestAssured.given;
13 | import static org.junit.Assert.assertEquals;
14 |
15 | public class C29_Get_DeSerialization extends BaseUrlDummyExample {
16 | /*
17 | http://dummy.restapiexample.com/api/v1/employee/3 url’ine
18 | bir GET request gonderdigimizde
19 | donen response’un status code’unun 200,
20 | content Type’inin application/json
21 | ve body’sinin asagidaki gibi oldugunu test edin.
22 | Expected Response Body
23 | {
24 | "status":"success",
25 | "data":{
26 | "id":3,
27 | "employee_name":"Ashton Cox",
28 | "employee_salary":86000,
29 | "employee_age":66,
30 | "profile_image":""
31 | },
32 | "message":"Successfully! Record has been fetched."
33 | }
34 | */
35 |
36 | @Test
37 | public void test01(){
38 | // 1- endpoint ve request body olustur
39 | specDummyExample.pathParams("pp1","employee","pp2","3");
40 | // 2- Soruda varsa expected data olustur
41 | Map expectedData = TestDataDummyExample.mapBodyOlustur();
42 |
43 | // 3- Request gonder donen response'i kaydet
44 |
45 | Response response= given().spec(specDummyExample)
46 | .when()
47 | .get("{pp1}/{pp2}");
48 | Map responseMap= response.as(HashMap.class);
49 |
50 | // 4- Assertion
51 |
52 | // donen response’un status code’unun 200,
53 | assertEquals(TestDataDummyExample.basariliSorguStatusCode,response.statusCode());
54 | // content Type’inin application/json
55 | assertEquals(TestDataDummyExample.contentType,response.contentType());
56 | // ve body’sinin asagidaki gibi oldugunu test edin.
57 |
58 | assertEquals(expectedData.get("message"),responseMap.get("message"));
59 | assertEquals(expectedData.get("status"),responseMap.get("status"));
60 |
61 | assertEquals(((Map)expectedData.get("data")).get("profile_image"),
62 | ((Map)responseMap.get("data")).get("profile_image"));
63 |
64 | assertEquals(((Map) expectedData.get("data")).get("employee_name"),
65 | ((Map) responseMap.get("data")).get("employee_name"));
66 |
67 | assertEquals(((Map) expectedData.get("data")).get("employee_salary"),
68 | ((Map) responseMap.get("data")).get("employee_salary"));
69 |
70 |
71 | assertEquals(((Map) expectedData.get("data")).get("id"),
72 | ((Map) responseMap.get("data")).get("id"));
73 |
74 | assertEquals(((Map) expectedData.get("data")).get("employee_age"),
75 | ((Map) responseMap.get("data")).get("employee_age"));
76 |
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C30_Post_Deserialization.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataHerokuapp;
4 | import baseUrl.BaseUrlHerokuapp;
5 | import io.restassured.http.ContentType;
6 | import io.restassured.response.Response;
7 | import org.junit.Assert;
8 | import org.junit.Test;
9 |
10 | import java.util.HashMap;
11 | import java.util.Map;
12 |
13 | import static io.restassured.RestAssured.given;
14 | import static org.junit.Assert.assertEquals;
15 |
16 | public class C30_Post_Deserialization extends BaseUrlHerokuapp {
17 |
18 | /*
19 | https://restful-booker.herokuapp.com/booking url’ine
20 | asagidaki body'ye sahip bir POST request gonderdigimizde
21 | donen response’un id haric asagidaki gibi oldugunu test edin.
22 | Request body
23 | {
24 | "firstname" : "Ahmet",
25 | "lastname" : “Bulut",
26 | "totalprice" : 500,
27 | "depositpaid" : false,
28 | "bookingdates" : {
29 | "checkin" : "2021-06-01",
30 | "checkout" : "2021-06-10"
31 | },
32 | "additionalneeds" : "wi-fi"
33 | }
34 | Response Body // expected data
35 | {
36 | "bookingid":24,
37 | "booking":{
38 | "firstname":"Ahmet",
39 | "lastname":"Bulut",
40 | "totalprice":500,
41 | "depositpaid":false,
42 | "bookingdates":{
43 | "checkin":"2021-06-01",
44 | "checkout":"2021-06-10"
45 | ,
46 | "additionalneeds":"wi-fi"
47 | }
48 | */
49 | @Test
50 | public void test01(){
51 | // 1- endpoint ve request body olustur
52 |
53 | specHerokuapp.pathParam("pp1","booking");
54 |
55 | Map requestBodyMap= TestDataHerokuapp.requestBodyMapOlustur();
56 |
57 | // 2- Soruda varsa expected data olustur
58 |
59 | Map expectedData= TestDataHerokuapp.responseBodyMapOlustur();
60 |
61 | // 3- Request gonder donen response'i kaydet
62 |
63 | Response response= given().contentType(ContentType.JSON).spec(specHerokuapp)
64 | .when().body(requestBodyMap)
65 | .post("{pp1}");
66 |
67 | Map responseMap= response.as(HashMap.class);
68 |
69 | // 4- Assertion
70 |
71 | assertEquals(((Map)expectedData.get("booking")).get("firstname"),
72 | ((Map)responseMap.get("booking")).get("firstname"));
73 |
74 | assertEquals(((Map) expectedData.get("booking")).get("lastname"),
75 | ((Map) responseMap.get("booking")).get("lastname"));
76 |
77 | assertEquals(((Map) expectedData.get("booking")).get("additionalneeds"),
78 | ((Map) responseMap.get("booking")).get("additionalneeds"));
79 |
80 | assertEquals(((Map) expectedData.get("booking")).get("totalprice"),
81 | ((Map) responseMap.get("booking")).get("totalprice"));
82 |
83 | assertEquals(((Map) expectedData.get("booking")).get("depositpaid"),
84 | ((Map) responseMap.get("booking")).get("depositpaid"));
85 |
86 | assertEquals(((Map)((Map) expectedData.get("booking")).get("bookingdates")).get("checkin"),
87 | ((Map)((Map) expectedData.get("booking")).get("bookingdates")).get("checkin"));
88 |
89 | assertEquals(((Map)((Map) expectedData.get("booking")).get("bookingdates")).get("checkout"),
90 | ((Map)((Map) expectedData.get("booking")).get("bookingdates")).get("checkout"));
91 |
92 |
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C31_Put_PojoClass.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import TestDatalari.TestDataJsonPlaceholder;
4 | import baseUrl.BaseUrlJsonPlaceholder;
5 | import io.restassured.http.ContentType;
6 | import io.restassured.response.Response;
7 | import org.junit.Assert;
8 | import org.junit.Test;
9 | import pojos.PojoJsonPlaceholder;
10 |
11 | import java.util.LinkedList;
12 |
13 | import static io.restassured.RestAssured.given;
14 | import static org.junit.Assert.assertEquals;
15 |
16 | public class C31_Put_PojoClass extends BaseUrlJsonPlaceholder {
17 | /*
18 | https://jsonplaceholder.typicode.com/posts/70 url'ine
19 | asagidaki body’e sahip bir PUT request yolladigimizda
20 | donen response’in
21 | status kodunun 200,
22 | content type’inin “application/json; charset=utf-8”,
23 | Connection header degerinin “keep-alive”
24 | ve response body’sinin asagida verilen ile ayni oldugunu test ediniz
25 | Request Body
26 | {
27 | "title":"Ahmet",
28 | "body":"Merhaba",
29 | "userId":10,
30 | "id":70
31 | }
32 | Response body : // expected data
33 | {
34 | "title":"Ahmet",
35 | "body":"Merhaba",
36 | "userId":10,
37 | "id":70
38 | }
39 | */
40 |
41 | @Test
42 | public void test01(){
43 | // 1- request url ve body olustur
44 | specJsonPlaceholder.pathParams("pp1","posts","pp2","70");
45 |
46 | PojoJsonPlaceholder requestBodyPojo=
47 | new PojoJsonPlaceholder("Ahmet","Merhaba",10,70);
48 |
49 |
50 | // 2- soruda varsa expected data olustur
51 |
52 | PojoJsonPlaceholder expectedDataPojo=
53 | new PojoJsonPlaceholder("Ahmet","Merhaba",10,70);
54 |
55 | // 3 - Response olustur, request gonderip sonucu response'a ata
56 | Response response= given().spec(specJsonPlaceholder).contentType(ContentType.JSON)
57 | .when().body(requestBodyPojo)
58 | .put("{pp1}/{pp2}");
59 | PojoJsonPlaceholder responsePojo=response.as(PojoJsonPlaceholder.class);
60 |
61 | // 4- Assert
62 | // expected data (Pojo) <====> response (Pojo)
63 | // expectedDataPojo responsePojo
64 |
65 | //status kodunun 200,
66 | assertEquals(TestDataJsonPlaceholder.basariliSorguStatusCode,response.statusCode());
67 | //content type’inin “application/json; charset=utf-8”,
68 |
69 | assertEquals(TestDataJsonPlaceholder.contentType,response.contentType());
70 |
71 | //Connection header degerinin “keep-alive”
72 |
73 | assertEquals(TestDataJsonPlaceholder.headerConnection,response.header("Connection"));
74 |
75 | // response body’sinin asagida verilen ile ayni oldugunu test ediniz
76 |
77 | assertEquals(expectedDataPojo.getTitle(),responsePojo.getTitle());
78 | assertEquals(expectedDataPojo.getBody(),responsePojo.getBody());
79 | assertEquals(expectedDataPojo.getUserId(),responsePojo.getUserId());
80 | assertEquals(expectedDataPojo.getId(),requestBodyPojo.getId());
81 |
82 | }
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C32_Post_Pojo.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlHerokuapp;
4 | import io.restassured.http.ContentType;
5 | import io.restassured.response.Response;
6 | import org.junit.Assert;
7 | import org.junit.Test;
8 | import pojos.PojoHerokuappBookingdates;
9 | import pojos.PojoHerokuappRequestBody;
10 | import pojos.PojoHerokuappResponseBody;
11 |
12 | import static io.restassured.RestAssured.given;
13 | import static org.junit.Assert.assertEquals;
14 |
15 | public class C32_Post_Pojo extends BaseUrlHerokuapp {
16 | /*
17 | https://restful-booker.herokuapp.com/booking url’ine
18 | asagidaki body'ye sahip bir POST request gonderdigimizde
19 | donen response’un asagidaki gibi oldugunu test edin.
20 | Request body
21 | {
22 | "firstname" : "Ahmet",
23 | "lastname" : “Bulut",
24 | "totalprice" : 500,
25 | "depositpaid" : false,
26 | "bookingdates" : {
27 | "checkin" : "2021-06-01",
28 | "checkout" : "2021-06-10"
29 | },
30 | "additionalneeds" : "wi-fi"
31 | }
32 | Response Body // expected data
33 | {
34 | "bookingid":24,
35 | "booking":{
36 | "firstname":"Ahmet",
37 | "lastname":"Bulut",
38 | "totalprice":500,
39 | "depositpaid":false,
40 | "bookingdates":{
41 | "checkin":"2021-06-01",
42 | "checkout":"2021-06-10"
43 | ,
44 | "additionalneeds":"wi-fi"
45 | }
46 | */
47 |
48 | @Test
49 | public void test01(){
50 | // 1- Request url ve body olustur
51 | specHerokuapp.pathParam("pp1","booking");
52 |
53 | PojoHerokuappBookingdates bookingdatesPojo=
54 | new PojoHerokuappBookingdates("2021-06-01","2021-06-10");
55 |
56 | PojoHerokuappRequestBody requestBodyPojo=
57 | new PojoHerokuappRequestBody("Ahmet","Bulut",500,false,bookingdatesPojo,"wi-fi");
58 |
59 | // 2- Soruda varsa expected data olustur
60 | bookingdatesPojo= new PojoHerokuappBookingdates("2021-06-01","2021-06-10");
61 |
62 | PojoHerokuappRequestBody bookingPojo=
63 | new PojoHerokuappRequestBody("Ahmet","Bulut",500,false,bookingdatesPojo,"wi-fi");
64 |
65 | PojoHerokuappResponseBody expectedResponseBodyPojo=
66 | new PojoHerokuappResponseBody(24,bookingPojo);
67 |
68 | /*
69 | PojoHerokuappResponseBody{
70 | bookingid=24,
71 | booking= PojoHerokuappRequestBody{
72 | firstname='Ahmet',
73 | lastname='Bulut',
74 | totalprice=500,
75 | depositpaid=false,
76 | bookingdates=PojoHerokuappBookingdates{
77 | checkin='2021-06-01',
78 | checkout='2021-06-10'},
79 | additionalneeds='wi-fi'}}
80 |
81 | */
82 | // 3 - Response olustur, request gonderip sonucu response'a ata
83 | Response response= given().spec(specHerokuapp).contentType(ContentType.JSON)
84 | .when().body(requestBodyPojo)
85 | .post("{pp1}");
86 |
87 | PojoHerokuappResponseBody responsePojo= response.as(PojoHerokuappResponseBody.class);
88 | /*
89 | PojoHerokuappResponseBody{
90 | bookingid=3090,
91 | booking=PojoHerokuappRequestBody{
92 | firstname='Ahmet',
93 | lastname='Bulut',
94 | totalprice=500,
95 | depositpaid=false,
96 | bookingdates=PojoHerokuappBookingdates{
97 | checkin='2021-06-01',
98 | checkout='2021-06-10'},
99 | additionalneeds='wi-fi'}}
100 |
101 | */
102 |
103 | // 4- Assertion
104 | // expectedResponseBodyPojo <=====> responsePojo
105 |
106 | assertEquals(expectedResponseBodyPojo.getBooking().getFirstname(),
107 | responsePojo.getBooking().getFirstname());
108 |
109 | assertEquals(expectedResponseBodyPojo.getBooking().getLastname(),
110 | responsePojo.getBooking().getLastname() );
111 |
112 | assertEquals(expectedResponseBodyPojo.getBooking().getTotalprice(),
113 | responsePojo.getBooking().getTotalprice());
114 |
115 | assertEquals(expectedResponseBodyPojo.getBooking().isDepositpaid(),
116 | responsePojo.getBooking().isDepositpaid());
117 |
118 | assertEquals(expectedResponseBodyPojo.getBooking().getAdditionalneeds(),
119 | responsePojo.getBooking().getAdditionalneeds() );
120 |
121 | assertEquals(expectedResponseBodyPojo.getBooking().getBookingdates().getCheckin(),
122 | responsePojo.getBooking().getBookingdates().getCheckin());
123 |
124 | assertEquals(expectedResponseBodyPojo.getBooking().getBookingdates().getCheckout(),
125 | responsePojo.getBooking().getBookingdates().getCheckout());
126 |
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C33_Get_Pojo.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import baseUrl.BaseUrlDummyExample;
4 | import io.restassured.path.json.JsonPath;
5 | import io.restassured.response.Response;
6 | import org.junit.Assert;
7 | import org.junit.Test;
8 | import pojos.PojoDummyExampleData;
9 | import pojos.PojoDummyExampleResponse;
10 |
11 | import static io.restassured.RestAssured.given;
12 | import static org.junit.Assert.assertEquals;
13 |
14 | public class C33_Get_Pojo extends BaseUrlDummyExample {
15 | /*
16 | http://dummy.restapiexample.com/api/v1/employee/3 url’ine
17 | bir GET request gonderdigimizde donen response’un asagidaki gibi oldugunu test edin.
18 |
19 | Response Body
20 | // expected data
21 | {
22 | "status":"success",
23 | "data":{
24 | "id":3,
25 | "employee_name":"Ashton Cox",
26 | "employee_salary":86000,
27 | "employee_age":66,
28 | "profile_image":""
29 | },
30 | "message":"Successfully! Record has been fetched."
31 | }
32 | */
33 |
34 | @Test
35 | public void test01(){
36 | // 1- Request url ve body olustur
37 | specDummyExample.pathParams("pp1","employee","pp2","3");
38 |
39 | // 2- Soruda varsa expected data olustur
40 |
41 | PojoDummyExampleData dataPojo=
42 | new PojoDummyExampleData(3,"Ashton Cox",86000,66,"");
43 |
44 | PojoDummyExampleResponse expectedResponseBody=
45 | new PojoDummyExampleResponse("success",dataPojo,"Successfully! Record has been fetched.");
46 |
47 | // 3 - Response olustur, request gonderip sonucu response'a ata
48 |
49 | Response response= given().spec(specDummyExample)
50 | .when()
51 | .get("{pp1}/{pp2}");
52 |
53 | /*
54 | pojos.PojoDummyExampleResponse@41ffaeb8[
55 | status=success,
56 | data=pojos.PojoDummyExampleData@43f0c2d1[
57 | id=3,
58 | employeeName=Ashton Cox,
59 | employeeSalary=86000,
60 | employeeAge=66,
61 | profileImage=],
62 | message=Successfully! Record has been fetched.]
63 |
64 | */
65 |
66 | // 4- Assertion
67 | // expectedResponseBody (Pojo) <=====> Response
68 | // hazir ceviriciler attribute isimlerini degistirdiginden, response'i Pojo'ya convert edemedik
69 | // Bu durumda testimize devam etmek icin response'i Jsonpath'e cevirebiliriz
70 | // expectedResponseBody (Pojo) <=====> ResponseJsonPath
71 |
72 | JsonPath responseJP= response.jsonPath();
73 |
74 |
75 | assertEquals(expectedResponseBody.getMessage(),responseJP.getString("message"));
76 | assertEquals(expectedResponseBody.getStatus(),responseJP.getString("status"));
77 |
78 | assertEquals(expectedResponseBody.getData().getId(),
79 | responseJP.get("data.id"));
80 | assertEquals(expectedResponseBody.getData().getEmployeeName(),
81 | responseJP.get("data.employee_name"));
82 | assertEquals(expectedResponseBody.getData().getEmployeeAge(),
83 | responseJP.get("data.employee_age"));
84 | assertEquals(expectedResponseBody.getData().getEmployeeSalary(),
85 | responseJP.get("data.employee_salary"));
86 | assertEquals(expectedResponseBody.getData().getProfileImage(),
87 | responseJP.get("data.profile_image"));
88 |
89 | }
90 |
91 | }
92 |
--------------------------------------------------------------------------------
/src/test/java/Tests/C34_Post_Pojo.java:
--------------------------------------------------------------------------------
1 | package Tests;
2 |
3 | import io.restassured.path.json.JsonPath;
4 | import io.restassured.response.Response;
5 | import org.junit.Assert;
6 | import org.junit.Test;
7 | import pojos.pojosHavaDurumu.*;
8 |
9 | import java.lang.module.ResolutionException;
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | import static io.restassured.RestAssured.given;
14 | import static org.junit.Assert.assertEquals;
15 |
16 | public class C34_Post_Pojo {
17 | /*
18 | https://api.openweathermap.org/data/2.5/weather?q=London&appid=f4ffe3b2ef1fcb3600ab1d7fbc88c2f0
19 | url’ine bir post request gonderdigimizde
20 | donen response’un asagidaki body’ye sahip oldugunu test ediniz
21 | {
22 | "coord": {
23 | "lon": -0.1257,
24 | "lat": 51.5085
25 | },
26 | "weather": [
27 | {
28 | "id": 804,
29 | "main": "Clouds",
30 | "description": "overcast clouds",
31 | "icon": "04d"
32 | }
33 | ],
34 | "base": "stations",
35 | "main": {
36 | "temp": 291.99,
37 | "feels_like": 292.18,
38 | "temp_min": 289.89,
39 | "temp_max": 293.71,
40 | "pressure": 1007,
41 | "humidity": 86
42 | },
43 | "visibility": 8000,
44 | "wind": {
45 | "speed": 1.54,
46 | "deg": 0
47 | },
48 | "clouds": {
49 | "all": 90
50 | },
51 | "dt": 1627206846,
52 | "sys": {
53 | "type": 2,
54 | "id": 2006068,
55 | "country": "GB",
56 | "sunrise": 1627186441,
57 | "sunset": 1627243183
58 | },
59 | "timezone": 3600,
60 | "id": 2643743,
61 | "name": "London",
62 | "cod": 200
63 | }
64 | */
65 |
66 | @Test
67 | public void test01(){
68 | // 1- Request url ve body olustur
69 |
70 | String url= "https://api.openweathermap.org/data/2.5/weather?q=London&appid=f4ffe3b2ef1fcb3600ab1d7fbc88c2f0";
71 |
72 | // 2- Soruda varsa expected data olustur
73 | Coord coordPojo=new Coord(-0.1257f,51.5085f);
74 | List weatherList= new ArrayList<>();
75 | Weather weatherPojo=new Weather(803,"Clouds","broken clouds","04d");
76 | weatherList.add(weatherPojo);
77 |
78 | Main mainPojo= new Main(281.55f,277.97f,280.35f,282.74f,1024,74);
79 |
80 | Wind windPojo= new Wind(7.2f,250,12.35f);
81 |
82 | Clouds cloudsPojo= new Clouds(58);
83 |
84 | Sys sysPojo= new Sys(2,2075535,"GB",1675237170,1675270107);
85 |
86 | PojoHavaDurumu expectedResponseBody=
87 | new PojoHavaDurumu(coordPojo,
88 | weatherList,
89 | "stations",
90 | mainPojo,
91 | 10000,
92 | windPojo,
93 | cloudsPojo,
94 | 1675248368,
95 | sysPojo,
96 | 0,
97 | 2643743,
98 | "London",
99 | 200);
100 | // 3 - Response olustur, request gonderip sonucu response'a ata
101 |
102 | Response response= given().when().post(url);
103 |
104 |
105 | // 4- Assertion
106 | // expectedResponseBody Pojo <===> response
107 |
108 | PojoHavaDurumu responsePojo= response.as(PojoHavaDurumu.class);
109 | // response'i Pojo'ya cevirdigimizde tum bilgileri getirirse
110 | // responsePojo'yu assertion'da kullanabiliriz
111 | // Eger null deger donerse, response'i JsonPath yapip assertion'da kullanabiliriz
112 |
113 | /*
114 | pojos.pojosHavaDurumu.PojoHavaDurumu@5bb51241[
115 | coord=pojos.pojosHavaDurumu.Coord@7479b626[lon=-0.1257,lat=51.5085],
116 | weather=[pojos.pojosHavaDurumu.Weather@74dbb1ee[id=803,main=Clouds,description=broken clouds,icon=04d]],
117 | base=stations,
118 | main=pojos.pojosHavaDurumu.Main@70f822e[temp=282.09,feelsLike=,tempMin=,tempMax=,
119 | pressure=1024,humidity=72],visibility=10000,wind=pojos.pojosHavaDurumu.Wind@3efedc6f[speed=8.23,deg=250,gust=],
120 | clouds=pojos.pojosHavaDurumu.Clouds@45bf6f39[all=58],dt=1675250181,
121 | sys=pojos.pojosHavaDurumu.Sys@6c42f2a1[type=2,id=2075535,country=GB,sunrise=1675237170,sunset=1675270107],
122 | timezone=0,
123 | id=2643743,
124 | name=London,
125 | cod=200]
126 | */
127 |
128 | JsonPath responseJP= response.jsonPath();
129 | // expectedResponseBody Pojo <===> responseJP
130 |
131 | assertEquals(expectedResponseBody.getCoord().getLon(),
132 | responseJP.get("coord.lon"));
133 |
134 | assertEquals(expectedResponseBody.getCoord().getLat(),
135 | responseJP.get("coord.lat"));
136 |
137 | assertEquals(expectedResponseBody.getBase(),
138 | responseJP.get("base"));
139 |
140 | assertEquals(expectedResponseBody.getSys().getCountry(),
141 | responseJP.get("sys.country"));
142 |
143 | assertEquals(expectedResponseBody.getName(),
144 | responseJP.get("name"));
145 |
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/test/java/baseUrl/BaseUrlDummyExample.java:
--------------------------------------------------------------------------------
1 | package baseUrl;
2 |
3 | import io.restassured.builder.RequestSpecBuilder;
4 | import io.restassured.specification.RequestSpecification;
5 | import org.junit.Before;
6 |
7 | public class BaseUrlDummyExample {
8 |
9 | protected RequestSpecification specDummyExample;
10 |
11 | @Before
12 | public void setup(){
13 |
14 | specDummyExample= new RequestSpecBuilder()
15 | .setBaseUri("http://dummy.restapiexample.com/api/v1")
16 | .build();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/test/java/baseUrl/BaseUrlHerokuapp.java:
--------------------------------------------------------------------------------
1 | package baseUrl;
2 |
3 | import io.restassured.builder.RequestSpecBuilder;
4 | import io.restassured.specification.RequestSpecification;
5 | import org.junit.Before;
6 |
7 | public class BaseUrlHerokuapp {
8 |
9 |
10 | protected RequestSpecification specHerokuapp;
11 |
12 | @Before
13 | public void setUp(){
14 |
15 | specHerokuapp= new RequestSpecBuilder()
16 | .setBaseUri("https://restful-booker.herokuapp.com")
17 | .build();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/test/java/baseUrl/BaseUrlJsonPlaceholder.java:
--------------------------------------------------------------------------------
1 | package baseUrl;
2 |
3 | import io.restassured.builder.RequestSpecBuilder;
4 | import io.restassured.specification.RequestSpecification;
5 | import org.junit.Before;
6 |
7 | public class BaseUrlJsonPlaceholder {
8 |
9 |
10 | protected RequestSpecification specJsonPlaceholder;
11 |
12 |
13 | @Before
14 | public void setUp(){
15 |
16 | specJsonPlaceholder= new RequestSpecBuilder()
17 | .setBaseUri("https://jsonplaceholder.typicode.com")
18 | .build();
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/src/test/java/pojos/PojoDummyExampleData.java:
--------------------------------------------------------------------------------
1 | package pojos;
2 |
3 |
4 |
5 |
6 | public class PojoDummyExampleData {
7 |
8 | private Integer id;
9 | private String employeeName;
10 | private Integer employeeSalary;
11 | private Integer employeeAge;
12 | private String profileImage;
13 |
14 | /**
15 | * No args constructor for use in serialization
16 | *
17 | */
18 | public PojoDummyExampleData() {
19 | }
20 |
21 | /**
22 | *
23 | * @param employeeName
24 | * @param employeeAge
25 | * @param id
26 | * @param profileImage
27 | * @param employeeSalary
28 | */
29 | public PojoDummyExampleData(Integer id, String employeeName, Integer employeeSalary, Integer employeeAge, String profileImage) {
30 | super();
31 | this.id = id;
32 | this.employeeName = employeeName;
33 | this.employeeSalary = employeeSalary;
34 | this.employeeAge = employeeAge;
35 | this.profileImage = profileImage;
36 | }
37 |
38 | public Integer getId() {
39 | return id;
40 | }
41 |
42 | public void setId(Integer id) {
43 | this.id = id;
44 | }
45 |
46 | public String getEmployeeName() {
47 | return employeeName;
48 | }
49 |
50 | public void setEmployeeName(String employeeName) {
51 | this.employeeName = employeeName;
52 | }
53 |
54 | public Integer getEmployeeSalary() {
55 | return employeeSalary;
56 | }
57 |
58 | public void setEmployeeSalary(Integer employeeSalary) {
59 | this.employeeSalary = employeeSalary;
60 | }
61 |
62 | public Integer getEmployeeAge() {
63 | return employeeAge;
64 | }
65 |
66 | public void setEmployeeAge(Integer employeeAge) {
67 | this.employeeAge = employeeAge;
68 | }
69 |
70 | public String getProfileImage() {
71 | return profileImage;
72 | }
73 |
74 | public void setProfileImage(String profileImage) {
75 | this.profileImage = profileImage;
76 | }
77 |
78 | @Override
79 | public String toString() {
80 | StringBuilder sb = new StringBuilder();
81 | sb.append(PojoDummyExampleData.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
82 | sb.append("id");
83 | sb.append('=');
84 | sb.append(((this.id == null)?"":this.id));
85 | sb.append(',');
86 | sb.append("employeeName");
87 | sb.append('=');
88 | sb.append(((this.employeeName == null)?"":this.employeeName));
89 | sb.append(',');
90 | sb.append("employeeSalary");
91 | sb.append('=');
92 | sb.append(((this.employeeSalary == null)?"":this.employeeSalary));
93 | sb.append(',');
94 | sb.append("employeeAge");
95 | sb.append('=');
96 | sb.append(((this.employeeAge == null)?"":this.employeeAge));
97 | sb.append(',');
98 | sb.append("profileImage");
99 | sb.append('=');
100 | sb.append(((this.profileImage == null)?"":this.profileImage));
101 | sb.append(',');
102 | if (sb.charAt((sb.length()- 1)) == ',') {
103 | sb.setCharAt((sb.length()- 1), ']');
104 | } else {
105 | sb.append(']');
106 | }
107 | return sb.toString();
108 | }
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/src/test/java/pojos/PojoDummyExampleResponse.java:
--------------------------------------------------------------------------------
1 | package pojos;
2 |
3 |
4 | public class PojoDummyExampleResponse {
5 |
6 | private String status;
7 | private PojoDummyExampleData pojoDummyExampleData;
8 | private String message;
9 |
10 | /**
11 | * No args constructor for use in serialization
12 | *
13 | */
14 | public PojoDummyExampleResponse() {
15 | }
16 |
17 | /**
18 | *
19 | * @param pojoDummyExampleData
20 | * @param message
21 | * @param status
22 | */
23 | public PojoDummyExampleResponse(String status, PojoDummyExampleData pojoDummyExampleData, String message) {
24 | super();
25 | this.status = status;
26 | this.pojoDummyExampleData = pojoDummyExampleData;
27 | this.message = message;
28 | }
29 |
30 | public String getStatus() {
31 | return status;
32 | }
33 |
34 | public void setStatus(String status) {
35 | this.status = status;
36 | }
37 |
38 | public PojoDummyExampleData getData() {
39 | return pojoDummyExampleData;
40 | }
41 |
42 | public void setData(PojoDummyExampleData pojoDummyExampleData) {
43 | this.pojoDummyExampleData = pojoDummyExampleData;
44 | }
45 |
46 | public String getMessage() {
47 | return message;
48 | }
49 |
50 | public void setMessage(String message) {
51 | this.message = message;
52 | }
53 |
54 | @Override
55 | public String toString() {
56 | StringBuilder sb = new StringBuilder();
57 | sb.append(PojoDummyExampleResponse.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
58 | sb.append("status");
59 | sb.append('=');
60 | sb.append(((this.status == null)?"":this.status));
61 | sb.append(',');
62 | sb.append("data");
63 | sb.append('=');
64 | sb.append(((this.pojoDummyExampleData == null)?"":this.pojoDummyExampleData));
65 | sb.append(',');
66 | sb.append("message");
67 | sb.append('=');
68 | sb.append(((this.message == null)?"":this.message));
69 | sb.append(',');
70 | if (sb.charAt((sb.length()- 1)) == ',') {
71 | sb.setCharAt((sb.length()- 1), ']');
72 | } else {
73 | sb.append(']');
74 | }
75 | return sb.toString();
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/src/test/java/pojos/PojoHerokuappBookingdates.java:
--------------------------------------------------------------------------------
1 | package pojos;
2 |
3 | public class PojoHerokuappBookingdates {
4 |
5 | // 1- tum variable'lari private olarak olustur
6 |
7 | private String checkin;
8 | private String checkout;
9 |
10 | // 2- tum variable'lar icin getter ve setter metodlari olusturalim
11 |
12 | public String getCheckin() {
13 | return checkin;
14 | }
15 |
16 | public void setCheckin(String checkin) {
17 | this.checkin = checkin;
18 | }
19 |
20 | public String getCheckout() {
21 | return checkout;
22 | }
23 |
24 | public void setCheckout(String checkout) {
25 | this.checkout = checkout;
26 | }
27 |
28 |
29 | // 3- tum parametreleri kullanarak bir constructor olusturalim
30 |
31 | public PojoHerokuappBookingdates(String checkin, String checkout) {
32 | this.checkin = checkin;
33 | this.checkout = checkout;
34 | }
35 |
36 |
37 | // 4- default constructor yerine manuel olarak parametresiz bir constructor olusturalim
38 |
39 | public PojoHerokuappBookingdates() {
40 | }
41 |
42 |
43 | // 5- toString metodu olusturalim
44 |
45 |
46 | @Override
47 | public String toString() {
48 | return "PojoHerokuappBookingdates{" +
49 | "checkin='" + checkin + '\'' +
50 | ", checkout='" + checkout + '\'' +
51 | '}';
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/java/pojos/PojoHerokuappRequestBody.java:
--------------------------------------------------------------------------------
1 | package pojos;
2 |
3 | public class PojoHerokuappRequestBody {
4 |
5 | // 1- tum variable'lari private olarak olustur
6 | private String firstname;
7 | private String lastname;
8 | private int totalprice;
9 | private boolean depositpaid;
10 | private PojoHerokuappBookingdates bookingdates;
11 | private String additionalneeds;
12 |
13 | // 2- tum variable'lar icin getter ve setter metodlari olusturalim
14 |
15 | public String getFirstname() {
16 | return firstname;
17 | }
18 |
19 | public void setFirstname(String firstname) {
20 | this.firstname = firstname;
21 | }
22 |
23 | public String getLastname() {
24 | return lastname;
25 | }
26 |
27 | public void setLastname(String lastname) {
28 | this.lastname = lastname;
29 | }
30 |
31 | public int getTotalprice() {
32 | return totalprice;
33 | }
34 |
35 | public void setTotalprice(int totalprice) {
36 | this.totalprice = totalprice;
37 | }
38 |
39 | public boolean isDepositpaid() {
40 | return depositpaid;
41 | }
42 |
43 | public void setDepositpaid(boolean depositpaid) {
44 | this.depositpaid = depositpaid;
45 | }
46 |
47 | public PojoHerokuappBookingdates getBookingdates() {
48 | return bookingdates;
49 | }
50 |
51 | public void setBookingdates(PojoHerokuappBookingdates bookingdates) {
52 | this.bookingdates = bookingdates;
53 | }
54 |
55 | public String getAdditionalneeds() {
56 | return additionalneeds;
57 | }
58 |
59 | public void setAdditionalneeds(String additionalneeds) {
60 | this.additionalneeds = additionalneeds;
61 | }
62 |
63 |
64 | // 3- tum parametreleri kullanarak bir constructor olusturalim
65 |
66 | public PojoHerokuappRequestBody(String firstname, String lastname, int totalprice, boolean depositpaid, PojoHerokuappBookingdates bookingdates, String additionalneeds) {
67 | this.firstname = firstname;
68 | this.lastname = lastname;
69 | this.totalprice = totalprice;
70 | this.depositpaid = depositpaid;
71 | this.bookingdates = bookingdates;
72 | this.additionalneeds = additionalneeds;
73 | }
74 |
75 |
76 | // 4- default constructor yerine manuel olarak parametresiz bir constructor olusturalim
77 |
78 | public PojoHerokuappRequestBody() {
79 | }
80 |
81 |
82 | // 5- toString metodu olusturalim
83 |
84 | @Override
85 | public String toString() {
86 | return "PojoHerokuappRequestBody{" +
87 | "firstname='" + firstname + '\'' +
88 | ", lastname='" + lastname + '\'' +
89 | ", totalprice=" + totalprice +
90 | ", depositpaid=" + depositpaid +
91 | ", bookingdates=" + bookingdates +
92 | ", additionalneeds='" + additionalneeds + '\'' +
93 | '}';
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/test/java/pojos/PojoHerokuappResponseBody.java:
--------------------------------------------------------------------------------
1 | package pojos;
2 |
3 | public class PojoHerokuappResponseBody {
4 |
5 | // 1- tum variable'lari private olarak olustur
6 | private int bookingid;
7 | private PojoHerokuappRequestBody booking;
8 |
9 | // 2- tum variable'lar icin getter ve setter metodlari olusturalim
10 |
11 | public int getBookingid() {
12 | return bookingid;
13 | }
14 |
15 | public void setBookingid(int bookingid) {
16 | this.bookingid = bookingid;
17 | }
18 |
19 | public PojoHerokuappRequestBody getBooking() {
20 | return booking;
21 | }
22 |
23 | public void setBooking(PojoHerokuappRequestBody booking) {
24 | this.booking = booking;
25 | }
26 |
27 |
28 | // 3- tum parametreleri kullanarak bir constructor olusturalim
29 |
30 | public PojoHerokuappResponseBody(int bookingid, PojoHerokuappRequestBody booking) {
31 | this.bookingid = bookingid;
32 | this.booking = booking;
33 | }
34 |
35 |
36 | // 4- default constructor yerine manuel olarak parametresiz bir constructor olusturalim
37 |
38 | public PojoHerokuappResponseBody() {
39 | }
40 |
41 |
42 | // 5- toString metodu olusturalim
43 |
44 | @Override
45 | public String toString() {
46 | return "PojoHerokuappResponseBody{" +
47 | "bookingid=" + bookingid +
48 | ", booking=" + booking +
49 | '}';
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/java/pojos/PojoJsonPlaceholder.java:
--------------------------------------------------------------------------------
1 | package pojos;
2 |
3 | public class PojoJsonPlaceholder {
4 |
5 | /*
6 | {
7 | "title":"Ahmet",
8 | "body":"Merhaba",
9 | "userId":10,
10 | "id":70
11 | }
12 | */
13 |
14 | // 1- tum variable'lari private olarak olustur
15 | private String title;
16 | private String body;
17 | private int userId;
18 | private int id;
19 |
20 | // 2- tum variable'lar icin getter ve setter metodlari olusturalim
21 |
22 | public String getTitle() {
23 | return title;
24 | }
25 |
26 | public void setTitle(String title) {
27 | this.title = title;
28 | }
29 |
30 | public String getBody() {
31 | return body;
32 | }
33 |
34 | public void setBody(String body) {
35 | this.body = body;
36 | }
37 |
38 | public int getUserId() {
39 | return userId;
40 | }
41 |
42 | public void setUserId(int userId) {
43 | this.userId = userId;
44 | }
45 |
46 | public int getId() {
47 | return id;
48 | }
49 |
50 | public void setId(int id) {
51 | this.id = id;
52 | }
53 |
54 |
55 | // 3- tum parametreleri kullanarak bir constructor olusturalim
56 |
57 | public PojoJsonPlaceholder(String title, String body, int userId, int id) {
58 | this.title = title;
59 | this.body = body;
60 | this.userId = userId;
61 | this.id = id;
62 | }
63 |
64 |
65 | // 4- default constructor yerine manuel olarak parametresiz bir constructor olusturalim
66 |
67 | public PojoJsonPlaceholder() {
68 | }
69 |
70 |
71 | // 5- toString metodu olusturalim
72 |
73 | @Override
74 | public String toString() {
75 | return "PojoJsonPlaceholder{" +
76 | "title='" + title + '\'' +
77 | ", body='" + body + '\'' +
78 | ", userId=" + userId +
79 | ", id=" + id +
80 | '}';
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/Clouds.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 |
4 | public class Clouds {
5 |
6 | private Integer all;
7 |
8 | /**
9 | * No args constructor for use in serialization
10 | *
11 | */
12 | public Clouds() {
13 | }
14 |
15 | /**
16 | *
17 | * @param all
18 | */
19 | public Clouds(Integer all) {
20 | super();
21 | this.all = all;
22 | }
23 |
24 | public Integer getAll() {
25 | return all;
26 | }
27 |
28 | public void setAll(Integer all) {
29 | this.all = all;
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | StringBuilder sb = new StringBuilder();
35 | sb.append(Clouds.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
36 | sb.append("all");
37 | sb.append('=');
38 | sb.append(((this.all == null)?"":this.all));
39 | sb.append(',');
40 | if (sb.charAt((sb.length()- 1)) == ',') {
41 | sb.setCharAt((sb.length()- 1), ']');
42 | } else {
43 | sb.append(']');
44 | }
45 | return sb.toString();
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/Coord.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 | public class Coord {
4 |
5 | private Float lon;
6 | private Float lat;
7 |
8 | /**
9 | * No args constructor for use in serialization
10 | *
11 | */
12 | public Coord() {
13 | }
14 |
15 | /**
16 | *
17 | * @param lon
18 | * @param lat
19 | */
20 | public Coord(Float lon, Float lat) {
21 | super();
22 | this.lon = lon;
23 | this.lat = lat;
24 | }
25 |
26 | public Float getLon() {
27 | return lon;
28 | }
29 |
30 | public void setLon(Float lon) {
31 | this.lon = lon;
32 | }
33 |
34 | public Float getLat() {
35 | return lat;
36 | }
37 |
38 | public void setLat(Float lat) {
39 | this.lat = lat;
40 | }
41 |
42 | @Override
43 | public String toString() {
44 | StringBuilder sb = new StringBuilder();
45 | sb.append(Coord.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
46 | sb.append("lon");
47 | sb.append('=');
48 | sb.append(((this.lon == null)?"":this.lon));
49 | sb.append(',');
50 | sb.append("lat");
51 | sb.append('=');
52 | sb.append(((this.lat == null)?"":this.lat));
53 | sb.append(',');
54 | if (sb.charAt((sb.length()- 1)) == ',') {
55 | sb.setCharAt((sb.length()- 1), ']');
56 | } else {
57 | sb.append(']');
58 | }
59 | return sb.toString();
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/Main.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 | public class Main {
4 |
5 | private Float temp;
6 | private Float feelsLike;
7 | private Float tempMin;
8 | private Float tempMax;
9 | private Integer pressure;
10 | private Integer humidity;
11 |
12 | /**
13 | * No args constructor for use in serialization
14 | *
15 | */
16 | public Main() {
17 | }
18 |
19 | /**
20 | *
21 | * @param feelsLike
22 | * @param tempMax
23 | * @param temp
24 | * @param humidity
25 | * @param pressure
26 | * @param tempMin
27 | */
28 | public Main(Float temp, Float feelsLike, Float tempMin, Float tempMax, Integer pressure, Integer humidity) {
29 | super();
30 | this.temp = temp;
31 | this.feelsLike = feelsLike;
32 | this.tempMin = tempMin;
33 | this.tempMax = tempMax;
34 | this.pressure = pressure;
35 | this.humidity = humidity;
36 | }
37 |
38 | public Float getTemp() {
39 | return temp;
40 | }
41 |
42 | public void setTemp(Float temp) {
43 | this.temp = temp;
44 | }
45 |
46 | public Float getFeelsLike() {
47 | return feelsLike;
48 | }
49 |
50 | public void setFeelsLike(Float feelsLike) {
51 | this.feelsLike = feelsLike;
52 | }
53 |
54 | public Float getTempMin() {
55 | return tempMin;
56 | }
57 |
58 | public void setTempMin(Float tempMin) {
59 | this.tempMin = tempMin;
60 | }
61 |
62 | public Float getTempMax() {
63 | return tempMax;
64 | }
65 |
66 | public void setTempMax(Float tempMax) {
67 | this.tempMax = tempMax;
68 | }
69 |
70 | public Integer getPressure() {
71 | return pressure;
72 | }
73 |
74 | public void setPressure(Integer pressure) {
75 | this.pressure = pressure;
76 | }
77 |
78 | public Integer getHumidity() {
79 | return humidity;
80 | }
81 |
82 | public void setHumidity(Integer humidity) {
83 | this.humidity = humidity;
84 | }
85 |
86 | @Override
87 | public String toString() {
88 | StringBuilder sb = new StringBuilder();
89 | sb.append(Main.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
90 | sb.append("temp");
91 | sb.append('=');
92 | sb.append(((this.temp == null)?"":this.temp));
93 | sb.append(',');
94 | sb.append("feelsLike");
95 | sb.append('=');
96 | sb.append(((this.feelsLike == null)?"":this.feelsLike));
97 | sb.append(',');
98 | sb.append("tempMin");
99 | sb.append('=');
100 | sb.append(((this.tempMin == null)?"":this.tempMin));
101 | sb.append(',');
102 | sb.append("tempMax");
103 | sb.append('=');
104 | sb.append(((this.tempMax == null)?"":this.tempMax));
105 | sb.append(',');
106 | sb.append("pressure");
107 | sb.append('=');
108 | sb.append(((this.pressure == null)?"":this.pressure));
109 | sb.append(',');
110 | sb.append("humidity");
111 | sb.append('=');
112 | sb.append(((this.humidity == null)?"":this.humidity));
113 | sb.append(',');
114 | if (sb.charAt((sb.length()- 1)) == ',') {
115 | sb.setCharAt((sb.length()- 1), ']');
116 | } else {
117 | sb.append(']');
118 | }
119 | return sb.toString();
120 | }
121 |
122 | }
123 |
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/PojoHavaDurumu.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 | import java.util.List;
4 |
5 | public class PojoHavaDurumu {
6 |
7 | private Coord coord;
8 | private List weather;
9 | private String base;
10 | private Main main;
11 | private Integer visibility;
12 | private Wind wind;
13 | private Clouds clouds;
14 | private Integer dt;
15 | private Sys sys;
16 | private Integer timezone;
17 | private Integer id;
18 | private String name;
19 | private Integer cod;
20 |
21 | /**
22 | * No args constructor for use in serialization
23 | *
24 | */
25 | public PojoHavaDurumu() {
26 | }
27 |
28 | /**
29 | *
30 | * @param visibility
31 | * @param timezone
32 | * @param main
33 | * @param clouds
34 | * @param sys
35 | * @param dt
36 | * @param coord
37 | * @param weather
38 | * @param name
39 | * @param cod
40 | * @param id
41 | * @param base
42 | * @param wind
43 | */
44 | public PojoHavaDurumu(Coord coord, List weather, String base, Main main, Integer visibility, Wind wind, Clouds clouds, Integer dt, Sys sys, Integer timezone, Integer id, String name, Integer cod) {
45 | super();
46 | this.coord = coord;
47 | this.weather = weather;
48 | this.base = base;
49 | this.main = main;
50 | this.visibility = visibility;
51 | this.wind = wind;
52 | this.clouds = clouds;
53 | this.dt = dt;
54 | this.sys = sys;
55 | this.timezone = timezone;
56 | this.id = id;
57 | this.name = name;
58 | this.cod = cod;
59 | }
60 |
61 | public Coord getCoord() {
62 | return coord;
63 | }
64 |
65 | public void setCoord(Coord coord) {
66 | this.coord = coord;
67 | }
68 |
69 | public List getWeather() {
70 | return weather;
71 | }
72 |
73 | public void setWeather(List weather) {
74 | this.weather = weather;
75 | }
76 |
77 | public String getBase() {
78 | return base;
79 | }
80 |
81 | public void setBase(String base) {
82 | this.base = base;
83 | }
84 |
85 | public Main getMain() {
86 | return main;
87 | }
88 |
89 | public void setMain(Main main) {
90 | this.main = main;
91 | }
92 |
93 | public Integer getVisibility() {
94 | return visibility;
95 | }
96 |
97 | public void setVisibility(Integer visibility) {
98 | this.visibility = visibility;
99 | }
100 |
101 | public Wind getWind() {
102 | return wind;
103 | }
104 |
105 | public void setWind(Wind wind) {
106 | this.wind = wind;
107 | }
108 |
109 | public Clouds getClouds() {
110 | return clouds;
111 | }
112 |
113 | public void setClouds(Clouds clouds) {
114 | this.clouds = clouds;
115 | }
116 |
117 | public Integer getDt() {
118 | return dt;
119 | }
120 |
121 | public void setDt(Integer dt) {
122 | this.dt = dt;
123 | }
124 |
125 | public Sys getSys() {
126 | return sys;
127 | }
128 |
129 | public void setSys(Sys sys) {
130 | this.sys = sys;
131 | }
132 |
133 | public Integer getTimezone() {
134 | return timezone;
135 | }
136 |
137 | public void setTimezone(Integer timezone) {
138 | this.timezone = timezone;
139 | }
140 |
141 | public Integer getId() {
142 | return id;
143 | }
144 |
145 | public void setId(Integer id) {
146 | this.id = id;
147 | }
148 |
149 | public String getName() {
150 | return name;
151 | }
152 |
153 | public void setName(String name) {
154 | this.name = name;
155 | }
156 |
157 | public Integer getCod() {
158 | return cod;
159 | }
160 |
161 | public void setCod(Integer cod) {
162 | this.cod = cod;
163 | }
164 |
165 | @Override
166 | public String toString() {
167 | StringBuilder sb = new StringBuilder();
168 | sb.append(PojoHavaDurumu.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
169 | sb.append("coord");
170 | sb.append('=');
171 | sb.append(((this.coord == null)?"":this.coord));
172 | sb.append(',');
173 | sb.append("weather");
174 | sb.append('=');
175 | sb.append(((this.weather == null)?"":this.weather));
176 | sb.append(',');
177 | sb.append("base");
178 | sb.append('=');
179 | sb.append(((this.base == null)?"":this.base));
180 | sb.append(',');
181 | sb.append("main");
182 | sb.append('=');
183 | sb.append(((this.main == null)?"":this.main));
184 | sb.append(',');
185 | sb.append("visibility");
186 | sb.append('=');
187 | sb.append(((this.visibility == null)?"":this.visibility));
188 | sb.append(',');
189 | sb.append("wind");
190 | sb.append('=');
191 | sb.append(((this.wind == null)?"":this.wind));
192 | sb.append(',');
193 | sb.append("clouds");
194 | sb.append('=');
195 | sb.append(((this.clouds == null)?"":this.clouds));
196 | sb.append(',');
197 | sb.append("dt");
198 | sb.append('=');
199 | sb.append(((this.dt == null)?"":this.dt));
200 | sb.append(',');
201 | sb.append("sys");
202 | sb.append('=');
203 | sb.append(((this.sys == null)?"":this.sys));
204 | sb.append(',');
205 | sb.append("timezone");
206 | sb.append('=');
207 | sb.append(((this.timezone == null)?"":this.timezone));
208 | sb.append(',');
209 | sb.append("id");
210 | sb.append('=');
211 | sb.append(((this.id == null)?"":this.id));
212 | sb.append(',');
213 | sb.append("name");
214 | sb.append('=');
215 | sb.append(((this.name == null)?"":this.name));
216 | sb.append(',');
217 | sb.append("cod");
218 | sb.append('=');
219 | sb.append(((this.cod == null)?"":this.cod));
220 | sb.append(',');
221 | if (sb.charAt((sb.length()- 1)) == ',') {
222 | sb.setCharAt((sb.length()- 1), ']');
223 | } else {
224 | sb.append(']');
225 | }
226 | return sb.toString();
227 | }
228 |
229 | }
230 |
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/Sys.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 | public class Sys {
4 |
5 | private Integer type;
6 | private Integer id;
7 | private String country;
8 | private Integer sunrise;
9 | private Integer sunset;
10 |
11 | /**
12 | * No args constructor for use in serialization
13 | *
14 | */
15 | public Sys() {
16 | }
17 |
18 | /**
19 | *
20 | * @param country
21 | * @param sunrise
22 | * @param sunset
23 | * @param id
24 | * @param type
25 | */
26 | public Sys(Integer type, Integer id, String country, Integer sunrise, Integer sunset) {
27 | super();
28 | this.type = type;
29 | this.id = id;
30 | this.country = country;
31 | this.sunrise = sunrise;
32 | this.sunset = sunset;
33 | }
34 |
35 | public Integer getType() {
36 | return type;
37 | }
38 |
39 | public void setType(Integer type) {
40 | this.type = type;
41 | }
42 |
43 | public Integer getId() {
44 | return id;
45 | }
46 |
47 | public void setId(Integer id) {
48 | this.id = id;
49 | }
50 |
51 | public String getCountry() {
52 | return country;
53 | }
54 |
55 | public void setCountry(String country) {
56 | this.country = country;
57 | }
58 |
59 | public Integer getSunrise() {
60 | return sunrise;
61 | }
62 |
63 | public void setSunrise(Integer sunrise) {
64 | this.sunrise = sunrise;
65 | }
66 |
67 | public Integer getSunset() {
68 | return sunset;
69 | }
70 |
71 | public void setSunset(Integer sunset) {
72 | this.sunset = sunset;
73 | }
74 |
75 | @Override
76 | public String toString() {
77 | StringBuilder sb = new StringBuilder();
78 | sb.append(Sys.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
79 | sb.append("type");
80 | sb.append('=');
81 | sb.append(((this.type == null)?"":this.type));
82 | sb.append(',');
83 | sb.append("id");
84 | sb.append('=');
85 | sb.append(((this.id == null)?"":this.id));
86 | sb.append(',');
87 | sb.append("country");
88 | sb.append('=');
89 | sb.append(((this.country == null)?"":this.country));
90 | sb.append(',');
91 | sb.append("sunrise");
92 | sb.append('=');
93 | sb.append(((this.sunrise == null)?"":this.sunrise));
94 | sb.append(',');
95 | sb.append("sunset");
96 | sb.append('=');
97 | sb.append(((this.sunset == null)?"":this.sunset));
98 | sb.append(',');
99 | if (sb.charAt((sb.length()- 1)) == ',') {
100 | sb.setCharAt((sb.length()- 1), ']');
101 | } else {
102 | sb.append(']');
103 | }
104 | return sb.toString();
105 | }
106 |
107 | }
108 |
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/Weather.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 | public class Weather {
4 |
5 | private Integer id;
6 | private String main;
7 | private String description;
8 | private String icon;
9 |
10 | /**
11 | * No args constructor for use in serialization
12 | *
13 | */
14 | public Weather() {
15 | }
16 |
17 | /**
18 | *
19 | * @param icon
20 | * @param description
21 | * @param main
22 | * @param id
23 | */
24 | public Weather(Integer id, String main, String description, String icon) {
25 | super();
26 | this.id = id;
27 | this.main = main;
28 | this.description = description;
29 | this.icon = icon;
30 | }
31 |
32 | public Integer getId() {
33 | return id;
34 | }
35 |
36 | public void setId(Integer id) {
37 | this.id = id;
38 | }
39 |
40 | public String getMain() {
41 | return main;
42 | }
43 |
44 | public void setMain(String main) {
45 | this.main = main;
46 | }
47 |
48 | public String getDescription() {
49 | return description;
50 | }
51 |
52 | public void setDescription(String description) {
53 | this.description = description;
54 | }
55 |
56 | public String getIcon() {
57 | return icon;
58 | }
59 |
60 | public void setIcon(String icon) {
61 | this.icon = icon;
62 | }
63 |
64 | @Override
65 | public String toString() {
66 | StringBuilder sb = new StringBuilder();
67 | sb.append(Weather.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
68 | sb.append("id");
69 | sb.append('=');
70 | sb.append(((this.id == null)?"":this.id));
71 | sb.append(',');
72 | sb.append("main");
73 | sb.append('=');
74 | sb.append(((this.main == null)?"":this.main));
75 | sb.append(',');
76 | sb.append("description");
77 | sb.append('=');
78 | sb.append(((this.description == null)?"":this.description));
79 | sb.append(',');
80 | sb.append("icon");
81 | sb.append('=');
82 | sb.append(((this.icon == null)?"":this.icon));
83 | sb.append(',');
84 | if (sb.charAt((sb.length()- 1)) == ',') {
85 | sb.setCharAt((sb.length()- 1), ']');
86 | } else {
87 | sb.append(']');
88 | }
89 | return sb.toString();
90 | }
91 |
92 | }
93 |
--------------------------------------------------------------------------------
/src/test/java/pojos/pojosHavaDurumu/Wind.java:
--------------------------------------------------------------------------------
1 | package pojos.pojosHavaDurumu;
2 |
3 | public class Wind {
4 |
5 | private Float speed;
6 | private Integer deg;
7 | private Float gust;
8 |
9 | /**
10 | * No args constructor for use in serialization
11 | *
12 | */
13 | public Wind() {
14 | }
15 |
16 | /**
17 | *
18 | * @param deg
19 | * @param speed
20 | * @param gust
21 | */
22 | public Wind(Float speed, Integer deg, Float gust) {
23 | super();
24 | this.speed = speed;
25 | this.deg = deg;
26 | this.gust = gust;
27 | }
28 |
29 | public Float getSpeed() {
30 | return speed;
31 | }
32 |
33 | public void setSpeed(Float speed) {
34 | this.speed = speed;
35 | }
36 |
37 | public Integer getDeg() {
38 | return deg;
39 | }
40 |
41 | public void setDeg(Integer deg) {
42 | this.deg = deg;
43 | }
44 |
45 | public Float getGust() {
46 | return gust;
47 | }
48 |
49 | public void setGust(Float gust) {
50 | this.gust = gust;
51 | }
52 |
53 | @Override
54 | public String toString() {
55 | StringBuilder sb = new StringBuilder();
56 | sb.append(Wind.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
57 | sb.append("speed");
58 | sb.append('=');
59 | sb.append(((this.speed == null)?"":this.speed));
60 | sb.append(',');
61 | sb.append("deg");
62 | sb.append('=');
63 | sb.append(((this.deg == null)?"":this.deg));
64 | sb.append(',');
65 | sb.append("gust");
66 | sb.append('=');
67 | sb.append(((this.gust == null)?"":this.gust));
68 | sb.append(',');
69 | if (sb.charAt((sb.length()- 1)) == ',') {
70 | sb.setCharAt((sb.length()- 1), ']');
71 | } else {
72 | sb.append(']');
73 | }
74 | return sb.toString();
75 | }
76 |
77 | }
--------------------------------------------------------------------------------
/target/test-classes/TestDatalari/TestDataDummyExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/TestDatalari/TestDataDummyExample.class
--------------------------------------------------------------------------------
/target/test-classes/TestDatalari/TestDataHerokuapp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/TestDatalari/TestDataHerokuapp.class
--------------------------------------------------------------------------------
/target/test-classes/TestDatalari/TestDataJsonPlaceholder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/TestDatalari/TestDataJsonPlaceholder.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C01_Get_ResponseBodyYazdirma.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C01_Get_ResponseBodyYazdirma.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C02_Get_ResponseBilgilerininManuelTestEdilmesi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C02_Get_ResponseBilgilerininManuelTestEdilmesi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C03_Get_ResponseDegerleriniOtomasyonIleTestEtme.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C03_Get_ResponseDegerleriniOtomasyonIleTestEtme.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C04_JsonObjesiOlusturma.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C04_JsonObjesiOlusturma.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C05_JsonObjesiOlusturma.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C05_JsonObjesiOlusturma.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C06_Put_ResponseBilgileriAssertion.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C06_Put_ResponseBilgileriAssertion.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C07_Get_ResponseBodyTesti.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C07_Get_ResponseBodyTesti.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C08_Post_ResponseBodyTesti.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C08_Post_ResponseBodyTesti.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C09_Get_TestYaparkenTekrarlardanKurtulma.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C09_Get_TestYaparkenTekrarlardanKurtulma.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C10_JsonPathKullanimi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C10_JsonPathKullanimi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C11_Post_JsonPathIleBodyTesti.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C11_Post_JsonPathIleBodyTesti.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C12_Get_ResponseBodyTestiListKullanimi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C12_Get_ResponseBodyTestiListKullanimi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C13_Get_ExpectedDataOlusturma.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C13_Get_ExpectedDataOlusturma.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C14_Post_ExpectedDataVeJsonPathIleAssertion.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C14_Post_ExpectedDataVeJsonPathIleAssertion.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C15_Get_SoftAssertIleExpectedDataTesti.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C15_Get_SoftAssertIleExpectedDataTesti.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C16_Put_SoftAssertIleExpectedDataTesti.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C16_Put_SoftAssertIleExpectedDataTesti.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C17_BaseUrlDummyRestapi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C17_BaseUrlDummyRestapi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C18_BaseUrlDummyRestapi2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C18_BaseUrlDummyRestapi2.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C19_BaseUrlHerokuapp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C19_BaseUrlHerokuapp.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C20_BaseUrlHerokuapp2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C20_BaseUrlHerokuapp2.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C21_BaseUrlHerokuappQueryParam.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C21_BaseUrlHerokuappQueryParam.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C22_BaseUrlHerokuappQueryParam.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C22_BaseUrlHerokuappQueryParam.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C23_Get_TestDataClassKullanimi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C23_Get_TestDataClassKullanimi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C24_Get_TestDataClassKullanimiDinamik.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C24_Get_TestDataClassKullanimiDinamik.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C25_Put_TestDataClassKullanimi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C25_Put_TestDataClassKullanimi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C26_Get_TestDataClassKullanimi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C26_Get_TestDataClassKullanimi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C27_Post_TestDataClassKullanimi.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C27_Post_TestDataClassKullanimi.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C28_Put_DeSerialization.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C28_Put_DeSerialization.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C29_Get_DeSerialization.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C29_Get_DeSerialization.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C30_Post_Deserialization.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C30_Post_Deserialization.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C31_Put_PojoClass.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C31_Put_PojoClass.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C32_Post_Pojo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C32_Post_Pojo.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C33_Get_Pojo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C33_Get_Pojo.class
--------------------------------------------------------------------------------
/target/test-classes/Tests/C34_Post_Pojo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/Tests/C34_Post_Pojo.class
--------------------------------------------------------------------------------
/target/test-classes/baseUrl/BaseUrlDummyExample.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/baseUrl/BaseUrlDummyExample.class
--------------------------------------------------------------------------------
/target/test-classes/baseUrl/BaseUrlHerokuapp.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/baseUrl/BaseUrlHerokuapp.class
--------------------------------------------------------------------------------
/target/test-classes/baseUrl/BaseUrlJsonPlaceholder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/baseUrl/BaseUrlJsonPlaceholder.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/PojoDummyExampleData.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/PojoDummyExampleData.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/PojoDummyExampleResponse.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/PojoDummyExampleResponse.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/PojoHerokuappBookingdates.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/PojoHerokuappBookingdates.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/PojoHerokuappRequestBody.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/PojoHerokuappRequestBody.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/PojoHerokuappResponseBody.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/PojoHerokuappResponseBody.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/PojoJsonPlaceholder.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/PojoJsonPlaceholder.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/Clouds.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/Clouds.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/Coord.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/Coord.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/Main.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/PojoHavaDurumu.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/PojoHavaDurumu.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/Sys.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/Sys.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/Weather.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/Weather.class
--------------------------------------------------------------------------------
/target/test-classes/pojos/pojosHavaDurumu/Wind.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/bulutluoz/udemy-API/9bed4cab49f16562bcf75e2604b82be0179b9349/target/test-classes/pojos/pojosHavaDurumu/Wind.class
--------------------------------------------------------------------------------