mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-06 10:45:23 +08:00
Merge branch 'stleary:master' into master
This commit is contained in:
@@ -71,7 +71,8 @@ public class ParserConfiguration {
|
||||
*
|
||||
* @param newVal
|
||||
* new value to use for the <code>keepStrings</code> configuration option.
|
||||
*
|
||||
* @param <T> the type of the configuration object
|
||||
*
|
||||
* @return The existing configuration will not be modified. A new configuration is returned.
|
||||
*/
|
||||
public <T extends ParserConfiguration> T withKeepStrings(final boolean newVal) {
|
||||
@@ -96,6 +97,8 @@ public class ParserConfiguration {
|
||||
* Using any negative value as a parameter is equivalent to setting no limit to the nesting depth,
|
||||
* which means the parses will go as deep as the maximum call stack size allows.
|
||||
* @param maxNestingDepth the maximum nesting depth allowed to the XML parser
|
||||
* @param <T> the type of the configuration object
|
||||
*
|
||||
* @return The existing configuration will not be modified. A new configuration is returned.
|
||||
*/
|
||||
public <T extends ParserConfiguration> T withMaxNestingDepth(int maxNestingDepth) {
|
||||
|
@@ -762,8 +762,8 @@ public class JSONMLTest {
|
||||
final String xml = JSONML.toString(originalObject);
|
||||
final JSONObject revertedObject = JSONML.toJSONObject(xml, false);
|
||||
final String newJson = revertedObject.toString();
|
||||
assertTrue("JSON Objects are not similar",originalObject.similar(revertedObject));
|
||||
assertEquals("original JSON does not equal the new JSON",originalJson, newJson);
|
||||
assertTrue("JSON Objects are not similar", originalObject.similar(revertedObject));
|
||||
assertTrue("JSON Strings are not similar", new JSONObject(originalJson).similar(new JSONObject(newJson)));
|
||||
}
|
||||
|
||||
// these tests do not pass for the following reasons:
|
||||
|
@@ -2095,7 +2095,9 @@ public class JSONObjectTest {
|
||||
"}";
|
||||
JSONObject jsonObject = new JSONObject(jsonObjectStr);
|
||||
assertTrue("jsonObject valueToString() incorrect",
|
||||
JSONObject.valueToString(jsonObject).equals(jsonObject.toString()));
|
||||
new JSONObject(JSONObject.valueToString(jsonObject))
|
||||
.similar(new JSONObject(jsonObject.toString()))
|
||||
);
|
||||
String jsonArrayStr =
|
||||
"[1,2,3]";
|
||||
JSONArray jsonArray = new JSONArray(jsonArrayStr);
|
||||
@@ -2106,7 +2108,8 @@ public class JSONObjectTest {
|
||||
map.put("key2", "val2");
|
||||
map.put("key3", "val3");
|
||||
assertTrue("map valueToString() incorrect",
|
||||
jsonObject.toString().equals(JSONObject.valueToString(map)));
|
||||
new JSONObject(jsonObject.toString())
|
||||
.similar(new JSONObject(JSONObject.valueToString(map))));
|
||||
Collection<Integer> collection = new ArrayList<Integer>();
|
||||
collection.add(Integer.valueOf(1));
|
||||
collection.add(Integer.valueOf(2));
|
||||
|
@@ -1234,7 +1234,7 @@ public class XMLTest {
|
||||
for (int numRead; (numRead = in.read(buffer, 0, buffer.length)) > 0; ) {
|
||||
expected.append(buffer, 0, numRead);
|
||||
}
|
||||
assertEquals(expected.toString(), actualString);
|
||||
assertTrue(XML.toJSONObject(expected.toString()).similar(XML.toJSONObject(actualString)));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
fail("file writer error: " +e.getMessage());
|
||||
|
Reference in New Issue
Block a user