CDLTest.java | ||
CookieTest.java | ||
JunitTestSuite.java | ||
LICENSE.txt | ||
PropertyTest.java | ||
README.md | ||
TestRunner.java | ||
Util.java | ||
XMLTest.java |
JSON-Java-unit-test
Unit tests to validate the JSON-Java GitHub project code (https://github.com/douglascrockford/JSON-java).
Test harness: http://junit.org
Coverage: http://www.eclemma.org/
Eclipse is the recommended development environment.
Run individual tests or JunitTestSuite using EclEmma Coverage, or execute the TestRunner application directly.
Test filenames should consist of the name of the module being tested, with the suffix "Test". For example, Cookie.java is tested by CookieTest.java. When adding a new unit test, don't forget to update JunitTestSuite.java.
The fundamental issues with JSON-Java testing are:
- JSONObjects are unordered, making simple string comparison ineffective.
- Comparisons via equals() is not currently supported. Neither JSONArray nor JSONObject overrride hashCode() or equals(), so comparison defaults to the Object equals(), which is not useful.
- Access to the JSONArray and JSONObject internal containers for comparison is not currently available.
- JSONObject sometimes wraps entries in quotes, other times does not, complicating comparisons.
When you start working on a test, add the empty file to the repository and update the readme, so that others will know that test is taken.
A unit test is considered complete when the coverage is >= 90% as measured by EclEmma.
Test file name | Coverage | Comments |
---|---|---|
Total coverage | 20.8% | |
CDL.java | 94.8% | Completed |
Cookie.java | 97.5% | Completed |
CookieList.java | 0% | |
HTTP.java | 0% | |
HTTPTokener.java | 0% | |
JSONArray.java | 15.3% | |
JSONException.java | 26.7% | |
JSONML.java | 0% | |
JSONObject.Null | 17.6% | |
JSONStringer.java | 0% | |
JSONTokener.java | 68.5% | |
JSONWriter.java | 0% | |
Property.java | 94.8% | Completed |
XML.java | 81.2% | Completed |
XMLTokener.java | 82.2% | Completed |