33import com .typicode .jsonplaceholder .helpers .RequestHelpers ;
44import io .cucumber .datatable .DataTable ;
55import io .cucumber .java .Before ;
6- import io .cucumber .java .en .Given ;
76import io .cucumber .java .en .Then ;
87import io .cucumber .java .en .When ;
98import org .everit .json .schema .Schema ;
109import org .everit .json .schema .loader .SchemaLoader ;
1110import org .json .JSONArray ;
1211import org .json .JSONObject ;
1312
14- import static org .junit .Assert .assertEquals ;
15-
1613import java .io .File ;
1714import java .io .IOException ;
1815import java .net .http .HttpResponse ;
1916import java .nio .file .Files ;
2017import java .util .ArrayList ;
21- import java .util .HashMap ;
2218import java .util .List ;
2319import java .util .Map ;
2420
21+ import static org .junit .Assert .assertEquals ;
22+
2523public class CommonSteps {
2624
2725 private static final String POSTS_ENDPOINT = "/posts" ;
@@ -101,7 +99,7 @@ public static void verifyResponseBodyAgainstJsonSchema(String type) throws IOExc
10199
102100 @ Then ("the results array contains {int} elements" )
103101 public static void verifyNumberOfResultsArrayElements (int numElements ) {
104- JSONArray results = new JSONArray (response .body ());
102+ JSONArray results = new JSONArray (response .body ());
105103 assertEquals (numElements , results .length ());
106104 }
107105
@@ -126,7 +124,7 @@ public static void verifyResponseBodyAgainstDataTable(DataTable dataTable) {
126124 Map <String , String > expectedBody = dataTable .subTable (1 , 0 ).asMap (String .class , String .class );
127125 JSONObject actual = new JSONObject (response .body ());
128126 assertEquals (expectedBody .keySet (), actual .keySet ());
129- expectedBody .forEach ((k ,v ) -> assertEquals (expectedBody .get (k ), actual .get (k ).toString ()));
127+ expectedBody .forEach ((k , v ) -> assertEquals (expectedBody .get (k ), actual .get (k ).toString ()));
130128 }
131129
132130 @ Then ("the response body is an empty JSON object" )
0 commit comments