Skip to content

Commit 9fa3ac5

Browse files
committed
Tidy code
1 parent 8c71362 commit 9fa3ac5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/test/java/com/typicode/jsonplaceholder/steps/CommonSteps.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,23 @@
33
import com.typicode.jsonplaceholder.helpers.RequestHelpers;
44
import io.cucumber.datatable.DataTable;
55
import io.cucumber.java.Before;
6-
import io.cucumber.java.en.Given;
76
import io.cucumber.java.en.Then;
87
import io.cucumber.java.en.When;
98
import org.everit.json.schema.Schema;
109
import org.everit.json.schema.loader.SchemaLoader;
1110
import org.json.JSONArray;
1211
import org.json.JSONObject;
1312

14-
import static org.junit.Assert.assertEquals;
15-
1613
import java.io.File;
1714
import java.io.IOException;
1815
import java.net.http.HttpResponse;
1916
import java.nio.file.Files;
2017
import java.util.ArrayList;
21-
import java.util.HashMap;
2218
import java.util.List;
2319
import java.util.Map;
2420

21+
import static org.junit.Assert.assertEquals;
22+
2523
public 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

Comments
 (0)