mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-09 20:14:28 +08: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