[VIVO-1320] Convert some org.json usages to Jackson

This commit is contained in:
Graham Triggs 2017-09-15 21:04:46 +01:00
parent 916640ef43
commit bf450aca21
6 changed files with 195 additions and 178 deletions

View file

@ -10,8 +10,7 @@ import java.util.regex.PatternSyntaxException;
import javax.servlet.ServletException;
import org.json.JSONException;
import org.json.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -53,14 +52,12 @@ public class JSONReconcileServletTest extends AbstractTestClass {
String defaultTypeList = null;
String serverName = null;
String schemaSpaceOutput = null;
JSONObject jsonResult = null;
ObjectNode jsonResult = null;
try {
jsonResult = reconcile.getMetadata(request, response, defaultNamespace, defaultTypeList, serverName, serverPort);
schemaSpaceOutput = jsonResult.getString("schemaSpace");
schemaSpaceOutput = jsonResult.get("schemaSpace").asText();
} catch (ServletException e) {
System.err.println("JSONReconcileServletTest getMetadata ServletException: " + e);
} catch (JSONException e) {
System.err.println("JSONReconcileServletTest getMetadata JSONException: " + e);
}
Assert.assertNotNull("output should not be null", jsonResult);
Assert.assertEquals("schemaSpaceOutput", defaultNamespace, schemaSpaceOutput);