Skip to content

Commit d11b071

Browse files
committed
Move Gson to testCompile and fix deprecation
1 parent 931a8f4 commit d11b071

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ dependencies {
2323
// For CLI
2424
compile group: 'com.beust', name: 'jcommander', version: '1.78'
2525

26-
// For parsing JSON
27-
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
28-
2926
// For making async HTTP requests
3027
compile group: 'org.apache.httpcomponents', name: 'httpasyncclient', version: '4.1.4'
3128

@@ -35,6 +32,9 @@ dependencies {
3532
// For creating and signing JWT
3633
compile group: 'org.bitbucket.b_c', name: 'jose4j', version: '0.7.0'
3734

35+
// For parsing JSON
36+
testCompile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
37+
3838
// For making HTTP requests
3939
testCompile group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.10'
4040

src/test/java/nl/martijndwars/webpush/selenium/TestingService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public TestingService(String baseUrl) {
3333
public int startTestSuite() throws IOException {
3434
String startTestSuite = request(baseUrl + "start-test-suite/");
3535

36-
JsonElement root = new JsonParser().parse(startTestSuite);
36+
JsonElement root = JsonParser.parseString(startTestSuite);
3737

3838
return root
3939
.getAsJsonObject()
@@ -129,7 +129,7 @@ protected String request(String uri, HttpEntity entity) throws IOException {
129129
String json = EntityUtils.toString(httpResponse.getEntity());
130130

131131
if (httpResponse.getStatusLine().getStatusCode() != 200) {
132-
JsonElement root = new JsonParser().parse(json);
132+
JsonElement root = JsonParser.parseString(json);
133133
JsonObject error = root.getAsJsonObject().get("error").getAsJsonObject();
134134

135135
String errorId = error.get("id").getAsString();
@@ -150,7 +150,7 @@ protected String request(String uri, HttpEntity entity) throws IOException {
150150
* @param response
151151
*/
152152
protected JsonObject getData(String response) {
153-
JsonElement root = new JsonParser().parse(response);
153+
JsonElement root = JsonParser.parseString(response);
154154

155155
return root
156156
.getAsJsonObject()

0 commit comments

Comments
 (0)