gnodet opened a new pull request, #20961:
URL: https://github.com/apache/camel/pull/20961

   This commit implements a new feature for the camel-mock component that 
allows JSON comparison while ignoring element order in arrays and objects. This 
is particularly useful when testing Camel routes with JSON payloads where the 
order of elements can vary.
   
   ## Key changes:
   - Added jsonEquals(Object expected) method to MockValueBuilder that defaults 
to ignoring array element order
   - Added jsonEquals(Object expected, boolean ignoreOrder) method for more 
control over comparison behavior
   - Implemented deep JSON comparison using camel-util-json library
   - Supports various input types: String, byte[], InputStream, JsonObject, 
JsonArray
   - Handles nested JSON structures (objects and arrays)
   - Provides semantic comparison that ignores key order in objects
   - Can optionally enforce strict array element order when needed
   
   ## Implementation details:
   - Uses Jsoner.deserialize() from camel-util-json for JSON parsing
   - Implements recursive comparison algorithm for nested structures
   - For unordered array comparison, uses a matching algorithm that finds 
corresponding elements
   - Handles primitives, nulls, booleans, numbers, and strings correctly
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to