@Test public void assertResponseHaveCorrectContentFromGet() throws Exception { JaxRsResponse response = RestRequest.req().get(functionalTestHelper.dataUri()); String body = response.getEntity(String.class); Map<String, Object> map = JsonHelper.jsonToMap(body); assertEquals(functionalTestHelper.nodeUri(), map.get("node")); assertNotNull(map.get("reference_node")); assertNotNull(map.get("node_index")); assertNotNull(map.get("relationship_index")); assertNotNull(map.get("extensions_info")); assertNotNull(map.get("batch")); response.close(); // Make sure advertised urls work response = RestRequest.req().get((String) map.get("reference_node")); assertEquals(200, response.getStatus()); response.close(); response = RestRequest.req().get((String) map.get("node_index")); assertEquals(204, response.getStatus()); response.close(); response = RestRequest.req().get((String) map.get("relationship_index")); assertEquals(204, response.getStatus()); response.close(); response = RestRequest.req().get((String) map.get("extensions_info")); assertEquals(200, response.getStatus()); response.close(); response = RestRequest.req().post((String) map.get("batch"), "[]"); assertEquals(200, response.getStatus()); response.close(); }
/** The service root is your starting point to discover the REST API. */ @Documented @Test @TestData.Title("Get service root") public void assert200OkFromGet() throws Exception { gen.get().expectedStatus(200).get(functionalTestHelper.dataUri()); }