Remove use of org.json

This commit removes all use of org.json in production code and moves
the json api to a test only dependency.

Closes gh-507
This commit is contained in:
Stephane Nicoll
2017-12-29 13:29:28 +01:00
parent 8e5b910af6
commit 63becddb94
23 changed files with 353 additions and 260 deletions

View File

@@ -16,13 +16,14 @@
package io.spring.initializr.service;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.spring.initializr.metadata.InitializrMetadata;
import io.spring.initializr.metadata.InitializrMetadataBuilder;
import io.spring.initializr.metadata.InitializrMetadataProvider;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -55,13 +56,13 @@ public class InitializrServiceSmokeTests {
private InitializrMetadataProvider metadataProvider;
@Test
public void metadataCanBeSerialized() throws URISyntaxException {
public void metadataCanBeSerialized() throws URISyntaxException, IOException {
RequestEntity<Void> request = RequestEntity.get(new URI("/"))
.accept(MediaType.parseMediaType("application/vnd.initializr.v2.1+json"))
.build();
ResponseEntity<String> response = this.restTemplate.exchange(request, String.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
new JSONObject(response.getBody());
new ObjectMapper().readTree(response.getBody());
}
@Test