stleary / json-java-unit-test Goto Github PK
View Code? Open in Web Editor NEWJunit test harness to validate the JSON-Java GitHub project code.
License: Apache License 2.0
Junit test harness to validate the JSON-Java GitHub project code.
License: Apache License 2.0
Changes to the JSON-Java directory and package structure are not anticipated.
Probably move the Junit test files to src/test/java/org/json/junit
Move the test data files (e.g. MyBean.java) to src/test/resources
Need to explicitly test how various input values are converted to object values.
Ex: "1" -> Integer, "1.0" -> Double for strings
Also need to verify object conversions.
Sigh. Do this for every single exception. This will be part of the "checked against previous unit tests" phase.
Going forward, string tests will be minimized in all test classes.
To prevent confusion for people with old forks of this project, it should have the README updated indicating the merge with the main project and should then be ARCHIVED.
I checked out both repositories on 20160212
and failed to compile.
[ERROR] /Users/onacit/tmp/JSON-Java-MG/src/test/java/org/json/junit/src/test/org/json/junit/CookieListTest.java:[182,73] cannot find symbol
[ERROR] symbol: variable JsonPath
[ERROR] location: class org.json.junit.CookieListTest
Especially the ones done early one, e.g. CDLTest.java
This will need to be addressed before stleary/JSON-java#259 can be included in a release.
The larger test modules are a mess of different tests. Partitioning may make them easier to sort through.
Util should call JSONObject.similar() and JSONArray.similar() in top level compares.
Use Jayway JsonPath. Probably keep the existing test utils as well.
New tests to add
Alternatives to existing tests (probably not)
stleary/JSON-java#153 was closed with the intent that only the JSONObject and JSONArray ctors might be changed as folllows:
public JSONObject(Map<String, ?> map) {
this.map = new HashMap<String, Object>();
if (map != null) {
for (final Entry<String, ?> e : map.entrySet()) {
final Object value = e.getValue();
if (value != null) {
this.map.put(e.getKey(), wrap(value));
}
}
}
}
public JSONArray(Collection<?> collection) {
this.myArrayList = new ArrayList<Object>();
if (collection != null) {
for (Object o : collection) {
this.myArrayList.add(JSONObject.wrap(o));
}
}
}
These limited changes pass unit tests. Need to add tests at least for Map<String, String> and Collection<String>. Also, if this is the only change made, are there any use cases where users' code could break or not work as intended? In particular, check the put(), opt(), and get() methods.
Is it possible to integrate these tests directly into code-repository douglascrockford/JSON-java?
The positive argument would be, that tests are directly next to code.
Feedback welcome.
If anyone wants to take a shot at this, please proceed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.