Commit Graph

105 Commits

Author SHA1 Message Date
Sean Leary e6d37c469d Merge pull request #788 from hofi1/bugfix/fix-JSON-flakiness
Fix string compare unit tests
2023-10-17 13:51:40 -05:00
simonh5 29a7f4622d remove JSONAssert 2023-10-13 21:23:09 -05:00
rudrajyoti biswas 0cdc38ac24 #653 - review comments updated. 2023-10-12 00:53:36 +05:30
Rudrajyoti Biswas d5277b126b Merge branch 'stleary:master' into master 2023-10-11 19:17:21 +00:00
Madjosz c93014cb53 add validity check for JSONObject constructors
* fixes #713
* document JSONException in JavaDoc
* remove unused Comparable<T> boundary to reuse GenericBean in test
2023-10-07 09:38:54 +02:00
rudrajyoti biswas 1a38879c90 #653 - optLong vs getLong inconsistencies
For exponential decimal conversion, number is not touched.
Leading zeros removed from numeric number strings before converting to number.
2023-10-06 21:34:00 +05:30
Sean Leary beb2fb5706 Merge pull request #772 from eamonnmcmanus/complexkey
Disallow nested objects and arrays as keys in objects.
2023-10-01 11:04:40 -05:00
Sean Leary ef68cdf810 Merge pull request #773 from eedijs/master
Add optJSONArray method to JSONObject with a default value
2023-09-30 11:47:01 -05:00
Éamonn McManus eaa5611ba3 Merge branch 'stleary:master' into complexkey 2023-09-28 11:33:08 -07:00
Éamonn McManus dbb113176b Add more test cases for unquoted text in objects and arrays. 2023-09-28 11:05:50 -07:00
Éamonn McManus 16967f322e Simplify the check for object keys that are themselves objects.
For object keys, we can just skip the part of `nextValue()` that parses values
that are objects or arrays. Then the existing logic for unquoted values will
already stop at `{` or `[`, and that will produce a `Missing value` exception.
2023-09-27 12:42:04 -07:00
Edijs db0fde2a56 Add optJSONArray method to JSONObject with a default value 2023-09-25 20:31:58 +03:00
Éamonn McManus 661114c50d Generalize the logic to disallow nested objects and arrays as keys in objects.
Fixes #771.
2023-09-20 10:50:48 -07:00
simonh5 ca88454f1c fix: flakiness in org.json.junit.JSONObjectTest#valueToString 2023-09-19 14:28:06 -05:00
Éamonn McManus 3e688afc66 Small test fixes.
One test method was missing `@Test` so it was never run.

One test method used another test class as the base for finding a test
resource. While this works in practice with Maven, it is not strictly
right.
2023-09-19 07:38:13 -07:00
Valentyn Kolesnikov 74cd73f97c Addressed compile warnings 2023-09-08 07:34:00 +03:00
dburbrid 3dd8f2ecd5 Correction of bug when compiling/testing on Windows: Issue537 file must be read as UTF-8 (Issue 745) 2023-08-28 19:03:40 +03:00
Valentyn Kolesnikov bae0b0dac9 Updated mockito 2023-08-28 19:01:47 +03:00
Valentyn Kolesnikov e563dbcaaa Setup java 8 as minimum version 2023-08-28 19:00:00 +03:00
Éamonn McManus b6ff0db984 Fix indentation in test. 2023-08-01 13:49:59 -07:00
Éamonn McManus c8a9e15a57 Don't skip past \0 when parsing JSON objects.
A better solution might be to use -1 instead 0 to represent EOF everywhere,
which of course means changing `char` variables to `int`. The solution here is
enough to solve the immediate problem, though.

Fixes #758.
2023-08-01 13:11:25 -07:00
dburbrid 4951ec48c8 Renamed object methods from ...Obj to ...Object.
Added object method for optDoubleObject (returns Double vice double).
Added similar methods in JSONArray.
Added test methods.
2023-06-29 09:39:34 +01:00
stleary 89f6e7f6a6 Merge branch 'master' into update-copyright 2022-08-26 20:59:00 -05:00
Sean Leary 346fb26f2d Merge pull request #683 from spaffrath/Issue_682_JSONString_similarity
Issue 682 JSONString similarity
2022-08-26 20:57:22 -05:00
stleary 6daabb43ab update-copyright - Replace copyright and license restrictions with Public Domain 2022-08-23 20:00:25 -05:00
stleary e0534b3ec7 initial attempt to test for inconsistent map types in JSONObject 2022-08-20 16:14:34 -05:00
Scott Paffrath 89f16ad0af Issue 682 JSONString similarity 2022-08-05 11:00:33 -07:00
John J. Aylward beae279b21 Updates tests to have updated message expectations 2022-03-21 13:06:19 -04:00
John J. Aylward 7a124d857d Add test cases for invalid input 2022-01-26 12:19:53 -05:00
Liam Miller-Cushon 812955e39d Use IdentityHashSet for cycle detection
Fixes https://github.com/stleary/JSON-java/issues/650
2021-11-26 20:07:21 -05:00
Zach fca7e17b38 Added test cases for self recursion and complex but no recursion 2021-11-18 14:53:22 -06:00
Zach fb96e870a9 add test case and modified old ones 2021-11-17 20:00:12 -06:00
Zach 638273af7a long circle test 2021-11-17 19:41:00 -06:00
Zach 1ffcf3915c successful test 2021-11-17 19:35:53 -06:00
Liam Miller-Cushon 8ca8a80753 Fix some typos 2021-08-25 13:56:44 -07:00
stleary 8680b10716 merge from master to pick up #616 and add one more test 2021-07-26 18:07:38 -05:00
stleary 2559114dbb Merge branch 'master' into fix-similar-check 2021-07-26 17:53:20 -05:00
John Aylward 579784d73e correct error in converting doubles to big decimals 2021-07-22 23:46:31 -04:00
John Aylward c03054b1a6 Add test to show bug 2021-07-22 22:57:15 -04:00
stleary cfbc306673 Fixes Issue #611 JsonObject.similar() returns after number entry check 2021-07-18 10:32:49 -05:00
Niels Frederiksen f91d0c8a52 New JSONObject.optJSONObject method with defaultValue parameter 2021-06-23 15:15:00 +02:00
Stranck efad1d73a7 Added UnitTests
(I hope they works :c)
2020-12-04 04:09:19 +01:00
John J. Aylward e4b76d6588 Add test to demonstrate the issue. See #573 2020-11-19 18:18:27 -05:00
John J. Aylward f37c2d67c5 Update for JSONArray.putAll methods
* Adds a copy constructor for JSONArray
* Updates the JSONArray.addAll(Object) method to be more lenient
* Adds support for JSONArray.putAll of generic Iterables
* Adds support for JSONArray.putAll of another JSONArray
2020-07-30 10:10:06 -04:00
stleary c63e78bbc7 initial commit 2020-07-18 17:14:39 -05:00
John J. Aylward f9908a6adb adds comment on test case to document why it was added. 2020-06-25 11:51:46 -04:00
John J. Aylward ba6c4089ea fixes #531
Add test result to confirm that #531 is working in latest version.
2020-06-25 11:42:07 -04:00
John J. Aylward c11c006e88 fix tests to not depend on HashSet key order 2020-06-05 19:09:10 -04:00
stleary cf00d2f265 initial commit 2020-06-03 21:12:19 -05:00
John J. Aylward b6ed0d4178 fix failing test case in Java1.7 2020-06-03 19:37:08 -04:00