mirror of
https://github.com/stleary/JSON-java.git
synced 2025-08-03 03:15:32 -04:00
Add test for JSONArray from Java collection.
This commit is contained in:
parent
d1327c2da3
commit
5d1c789490
@ -228,6 +228,19 @@ public class JSONArrayTest {
|
|||||||
Util.checkJSONArrayMaps(jaRaw);
|
Util.checkJSONArrayMaps(jaRaw);
|
||||||
Util.checkJSONArrayMaps(jaInt);
|
Util.checkJSONArrayMaps(jaInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void jsonArrayByListWithNestedNullValue() {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
|
||||||
|
Map<String, Object> sub = new HashMap<String, Object>();
|
||||||
|
sub.put("nullKey", null);
|
||||||
|
list.add(sub);
|
||||||
|
JSONParserConfiguration parserConfiguration = new JSONParserConfiguration().withJavaNullAsJsonNull(true);
|
||||||
|
JSONArray jsonArray = new JSONArray(list, parserConfiguration);
|
||||||
|
JSONObject subObject = jsonArray.getJSONObject(0);
|
||||||
|
assertTrue(subObject.has("nullKey"));
|
||||||
|
assertEquals(JSONObject.NULL, subObject.get("nullKey"));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests consecutive calls to putAll with array and collection.
|
* Tests consecutive calls to putAll with array and collection.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user