mirror of
https://github.com/stleary/JSON-java.git
synced 2026-01-24 00:03:17 -05:00
Update for JSONArray.putAll methods
* Adds a copy constructor for JSONArray * Updates the JSONArray.addAll(Object) method to be more lenient * Adds support for JSONArray.putAll of generic Iterables * Adds support for JSONArray.putAll of another JSONArray
This commit is contained in:
@@ -3201,4 +3201,11 @@ public class JSONObjectTest {
|
||||
fail("Expected an exception");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIssue548ObjectWithEmptyJsonArray() {
|
||||
JSONObject jsonObject = new JSONObject("{\"empty_json_array\": []}");
|
||||
assertTrue("missing expected key 'empty_json_array'", jsonObject.has("empty_json_array"));
|
||||
assertNotNull("'empty_json_array' should be an array", jsonObject.getJSONArray("empty_json_array"));
|
||||
assertEquals("'empty_json_array' should have a length of 0", 0, jsonObject.getJSONArray("empty_json_array").length());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user