stleary / JSON-Java-unit-test

Junit test harness to validate the JSON-Java GitHub project code.
Apache License 2.0
28 stars 45 forks source link

valueToString() and write() tests #53

Closed run2000 closed 8 years ago

run2000 commented 8 years ago

This adds some new tests for JSONObject#valueToString() and JSONObject#write() methods. These are very similar in functionality, but have a subtle case that is different when creating a string for a JSONString object that returns null. Goes through cases where an exception is thrown, and where toString() also returns null.

Also fixed up a test on JSONStringer for object nesting, which didn't fail where it should've.

Finally, JSONObject#toMap() and JSONArray#toList() get some unit test coverage.

Also find a couple of tests currently commented out. These depend on the pull request #241 on JSON-java, that replaces Writer with Appendable. These tests won't compile until that request goes in, though it will also cause one of the tests in JSONStringTest to fail.