Commit Graph

62 Commits

Author SHA1 Message Date
Sean Leary d3c7eaf17e restore-jsonparserconfiguration: fix unit tests to work when strictMode default is true 2024-12-15 13:18:39 -06:00
Sean Leary ab1b9a3459 Revert "Merge pull request #888 from rikkarth/fix/887"
This reverts commit 14f71274f7, reversing
changes made to 054786e300.
2024-11-03 09:49:23 -06:00
rikkarth 48dfeb84b0 fix(#887): unit tests, uncommented tests after fix 2024-04-28 23:52:53 +01:00
Sean Leary 0180bd90f0 fixes the broken XMLTest cases 2024-04-28 12:41:58 -05:00
Sean Leary d520210ea2 Added one more example to XMLTest clarifyCurrentBehavior() 2024-02-25 10:45:34 -06:00
Sean Leary 898288810f add unit tests to clarify current behavior for JSONObject and XML 2024-02-24 21:07:12 -06:00
Sean Leary 771c82c4eb backing out recent changes to optLong, getLong. See #868 2024-02-24 13:07:51 -06:00
Keaton Taylor 9ee10fdfc8 Merge remote-tracking branch 'origin/master' into feature-disable-whitespace-trim 2023-11-27 11:15:49 +02:00
Keaton Taylor 30f5b2de79 Add a config flag to disable whitespace trimming 2023-11-20 17:50:22 +02:00
Saiharshith Karuneegar Ramesh 1a61af8255 Fixed flaky tests in XMLTest.java 2023-11-13 13:25:30 -06:00
rudrajyoti biswas c6ec2f0e4c #748 - close XML tag explicitly for empty tags with configuration. 2023-10-25 23:23:00 +05:30
Rudrajyoti Biswas 04a4c5a3ec Merge branch 'stleary:master' into master 2023-10-21 12:29:31 +00:00
rudrajyoti biswas 2374766018 #790 - Update XML with changes for string to number conversion.
For now the code remains duplicated in JSON and XML parsers.
Unit test cases updated to comply with number expectations.
2023-10-19 14:07:53 +05:30
rudrajyoti biswas 1d0775cce7 Revert changes with feature and refactor together. 2023-10-19 10:28:11 +05:30
simonh5 4dfd779b1c fix: flakiness in org.json.junit.XMLTest#testIndentComplicatedJsonObjectWithArrayAndWithConfig 2023-10-14 17:21:06 -05:00
rudrajyoti biswas 7b2677ac5a #790 - Update XML with changes for string to number conversion.
Moved the code logic to a common utility to de-duplicate.
2023-10-14 10:05:36 +05:30
Madjosz 0e4a94d91d fix failing test XML test on Windows machines 2023-10-07 09:38:07 +02:00
dburbrid 3d524349a1 Correction of bug when compiling/testing on Windows: Issue537 file must be read as UTF-8 (Issue 745) 2023-06-26 09:33:03 +01:00
superMaaax 48fb5261fe Fixed Flaky Tests Caused by JSON permutations
###Description
Flaky Tests found using NonDex by running the commands -
mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.json.junit.XMLTest#testIndentComplicatedJsonObject

mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.json.junit.XMLTest#testIndentSimpleJsonArray

mvn -pl . edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.json.junit.XMLTest#testIndentSimpleJsonObject

The logged failure was-

[ERROR] Failures:
[ERROR] XMLTest.testIndentSimpleJsonObject:1193 expected:<...>
<employee>
<[married>true</married>
<name>sonoo</name>
<salary>56000</salary]>
</employee>
</Te...> but was:<...>
<employee>
<[name>sonoo</name>
<salary>56000</salary>
<married>true</married]>
</employee>
</Te...>

The issue is the same for all three tests, so here I only show the failure message for the third test (to reduce the length of the error message).

### Investigation

The tests fail with a comparison error while comparing an expected JSON String and the result from the value returned from XML.toString(). The toString function of XML makes no guarantees as to the iteration order of the attributes in the object. This makes the test outcome non-deterministic, and the test fails whenever the function returns a mismatch in order of the elements in the JSON String. To fix this, the expected and actual keys should be checked in a more deterministic way so that the assertions do not fail.

### Fix

Expected and Actual values can be converted into JSONObject and the similar function can be used to compare these objects. As this function compares the values inside the JSONObjects without needing order, the test becomes deterministic and ensures that the flakiness from the test is removed.

The PR does not introduce a breaking change.
2023-03-21 20:58:32 -05:00
Cleydyr de Albuquerque 651511f500 tests: add new test to verify that an XML having the permitted nesting depth can be converted 2023-02-01 20:22:47 +01:00
Cleydyr de Albuquerque a14cb12c85 refactor: keep consistence with other tests and tidy up constant 2023-02-01 20:22:32 +01:00
Cleydyr de Albuquerque f566a1d9ee fix: limit the nesting depth 2023-02-01 16:26:58 +01:00
Dean 85495facbd Corrected test 2022-10-10 11:12:35 +01:00
Dean 7aba3ac941 System line seperator now being used in JUnit test 2022-10-10 11:09:42 +01:00
Dean a2c0562e04 Removed unused import 2022-10-07 15:04:09 +01:00
Dean 4a8ff28fd8 Reduced Test code length by using resources 2022-10-07 10:35:06 +01:00
Dean fa457a4113 Test cases for XML toString indentation 2022-10-06 12:01:26 +01:00
Dean b7f708b222 Altered XML toString to allow indentation param 2022-10-06 12:01:13 +01:00
stleary 6daabb43ab update-copyright - Replace copyright and license restrictions with Public Domain 2022-08-23 20:00:25 -05:00
stleary 76ec2fe5a2 Revert accidentally changed file 2021-06-22 19:46:33 -05:00
stleary 8f3e5ade18 Add logo image 2021-06-22 19:34:22 -05:00
Rahul Kumar 56d4130a86 Added shallow copy for config map 2020-09-06 11:17:10 +05:30
Rahul Kumar 310f18fcdc Addressed comment 2020-09-03 11:17:10 +05:30
Rahul Kumar 0a8091c954 Added documentation 2020-08-05 22:25:45 +05:30
Rahul Kumar 61c1a882d6 Added configuration support for type conversion using Map 2020-08-03 08:54:59 +05:30
Rahul Kumar 250f74ef4d Added type conversion support 2020-08-03 08:18:20 +05:30
stleary 98cd8ef8b2 fix CI build error 2020-07-24 03:24:41 -05:00
Sean Leary 78528102d0 Merge pull request #543 from johnjaylward/RefactorXmlConfiguration
Refactor XMLConfiguration to use Builder Pattern
2020-07-24 02:49:28 -05:00
Sean Leary 0e34d8d383 Merge pull request #539 from stleary/unit-tests-1.6
Bring Junit tests to Java 1.6 compatibility
2020-07-24 02:48:38 -05:00
John J. Aylward 4f1c8b2d6f formatting 2020-07-21 11:30:35 -04:00
John J. Aylward 5a31f9ef5f Refs #541
Updates XML configuration to use a builder pattern instead of
constructors with many parameters
2020-07-21 11:08:40 -04:00
John J. Aylward e0a6c2ef34 refs #537 Show error when unescaping all-caps entity directly 2020-07-20 18:36:52 -04:00
John J. Aylward c98da43184 Refs #537 Add test cases to verify no issue 2020-07-20 18:25:51 -04:00
stleary c63e78bbc7 initial commit 2020-07-18 17:14:39 -05:00
John J. Aylward c11c006e88 fix tests to not depend on HashSet key order 2020-06-05 19:09:10 -04:00
stleary 2b0a8838ef gradle support 2020-05-22 11:17:44 -05:00
meiskalt7 fa173fa51a add test for xsi:nil to null conversion disabled 2019-04-21 00:53:39 +07:00
meiskalt7 614e8359b9 add test for xsi:nil to null conversion 2019-04-18 21:42:57 +07:00
John J. Aylward e7f7d348cd * updates tests to cover more cases of tokenizing
* uncomments tests that should now work
2018-12-10 11:45:10 -05:00
Sean Leary e699abb1c6 Merge pull request #61 from johnjaylward/XmlEscape
Test cases Xml escapes
2018-12-08 20:09:03 -06:00