Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for adding ignore order feature for verifyXml #451

Open
wuh3 opened this issue Dec 20, 2023 · 3 comments
Open

Request for adding ignore order feature for verifyXml #451

wuh3 opened this issue Dec 20, 2023 · 3 comments

Comments

@wuh3
Copy link

wuh3 commented Dec 20, 2023

Hello developers,

Due to some code stability requirements, I may need the verifyXml(String, Option) in Approvals.java to pass if the fields in the XML string are shuffled. I wonder if you could add a new feature that can satisfy this. By stability requirement, I mean specifically when I apply the tool NonDex, which will shuffle implementation-dependent operations. The NonDex tool will shuffle the elements inside of the xml string which will cause the verifyXml method to fail.

I saw some similar issues were raised previously, and the closest one I found was https://github.com/approvals/ApprovalTests.Java/issues/301. However, I think the proposed solution Option.withComparator() may not fit my demand that well since I am testing an xml string instead of a File. It would be great if you could help!

@LarsEckart
Copy link
Contributor

hello,

I'm not sure I can follow. Any chance you can add an example for your ask?

do you want to compare
<xml attributeA=B attributeC=D> with <xml attributeC=D attributeA=B> and assert that they are still the same?

@wuh3
Copy link
Author

wuh3 commented Dec 20, 2023

Hello @LarsEckart ,

Yes, this is exactly what I meant. I know this is just a trivial order issue, and regular runs will not cause error. But, under certain circumstances with very high stability requirements, such order issue will cause trouble. Thank you for your understanding.

@LarsEckart
Copy link
Contributor

hello,

been a while but thank you for your patience. We looked at the issue and think we can do it. We already have a similar solution for JSON. We're curious though, what XML library do you use, jaxb?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants