Compare JSON response using JUnit and JSONassert
问题 I'm relatively new to Java and I'm asking to write test of JSON response server. I found JSONassert very useful but I didn't succeed to write the method getRESTData . Anybody can help please? @Test public void testGetFriends() throws JSONException { JSONObject data = getRESTData("/friends/367.json"); String expected = "{friends:[{id:123,name:\"Corby Page\"}" + ",{id:456,name:\"Solomon Duskis\"}]}"; JSONAssert.assertEquals(expected, data, false); } 回答1: You can get the data as String and pass