Repository: atlas Updated Branches: refs/heads/master d1aa36c46 -> 1f8e2146e
http://git-wip-us.apache.org/repos/asf/atlas/blob/1f8e2146/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java b/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java index c0bbf09..3c5d031 100644 --- a/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/resources/AdminResourceTest.java @@ -18,9 +18,8 @@ package org.apache.atlas.web.resources; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.atlas.web.service.ServiceState; -import org.codehaus.jettison.json.JSONException; -import org.codehaus.jettison.json.JSONObject; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.testng.annotations.BeforeMethod; @@ -44,27 +43,27 @@ public class AdminResourceTest { } @Test - public void testStatusOfActiveServerIsReturned() throws JSONException { + public void testStatusOfActiveServerIsReturned() { when(serviceState.getState()).thenReturn(ServiceState.ServiceStateValue.ACTIVE); AdminResource adminResource = new AdminResource(serviceState, null, null, null, null); Response response = adminResource.getStatus(); assertEquals(response.getStatus(), HttpServletResponse.SC_OK); - JSONObject entity = (JSONObject) response.getEntity(); - assertEquals(entity.get("Status"), "ACTIVE"); + ObjectNode entity = (ObjectNode) response.getEntity(); + assertEquals(entity.get("Status").asText(), "ACTIVE"); } @Test - public void testResourceGetsValueFromServiceState() throws JSONException { + public void testResourceGetsValueFromServiceState() { when(serviceState.getState()).thenReturn(ServiceState.ServiceStateValue.PASSIVE); AdminResource adminResource = new AdminResource(serviceState, null, null, null, null); Response response = adminResource.getStatus(); verify(serviceState).getState(); - JSONObject entity = (JSONObject) response.getEntity(); - assertEquals(entity.get("Status"), "PASSIVE"); + ObjectNode entity = (ObjectNode) response.getEntity(); + assertEquals(entity.get("Status").asText(), "PASSIVE"); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/atlas/blob/1f8e2146/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java b/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java index e732dbf..4c07953 100644 --- a/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/util/ServletsTest.java @@ -18,8 +18,8 @@ package org.apache.atlas.web.util; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.atlas.AtlasClient; -import org.codehaus.jettison.json.JSONObject; import org.testng.annotations.Test; import javax.ws.rs.core.Response; @@ -33,8 +33,8 @@ public class ServletsTest { Response response = Servlets.getErrorResponse(new NullPointerException(), Response.Status.INTERNAL_SERVER_ERROR); assertNotNull(response); - JSONObject responseEntity = (JSONObject) response.getEntity(); + ObjectNode responseEntity = (ObjectNode) response.getEntity(); assertNotNull(responseEntity); - assertNotNull(responseEntity.getString(AtlasClient.ERROR)); + assertNotNull(responseEntity.get(AtlasClient.ERROR)); } }