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

Add getters for field path in ComparisonDifference #3007

Merged
merged 1 commit into from Apr 12, 2023
Merged

Add getters for field path in ComparisonDifference #3007

merged 1 commit into from Apr 12, 2023

Conversation

aakatov
Copy link
Contributor

@aakatov aakatov commented Mar 30, 2023

Check List:
Fixes absense of getters for field path in ComparisonDifference
Unit tests : NA
Javadoc with a code example (on API only) : NA
PR meets the contributing guidelines

org.assertj.core.api.recursive.comparison.ComparisonDifference unnecessery closes access to both decomposedPath and concatenatedPath.
org.assertj.core.api.recursive.comparison.RecursiveComparisonDifferenceCalculator#determineDifferences is a public method but you cannot get a field path from its result. It would be nice to have getters on it to use in an application code.

@scordio
Copy link
Member

scordio commented Mar 30, 2023

Would you have a concrete use case to share?

@aakatov
Copy link
Contributor Author

aakatov commented Mar 30, 2023

@scordio I have an application where as a part of regression testing we create a lot of entity objects, and we need to compare them field by field with entities we already have in the system. By the end, we generate an Excel report with differences:
image

I'm trying to use RecursiveComparisonDifferenceCalculator for it, but I can't get field names and their path from the result of comparison.

@scordio scordio added the theme: recursive comparison An issue related to the recursive comparison label Apr 11, 2023
@scordio scordio added this to the 3.25.0 milestone Apr 11, 2023
@joel-costigliola
Copy link
Member

@aakatov do you need to expose both the concatenatedPath and the decomposedPath, if it's for reporting I think you could simply used the concatenatedPath.
Note that you can compute the decomposedPath from the concatenatedPath and vice versa, so no need to expose them both.

@aakatov
Copy link
Contributor Author

aakatov commented Apr 12, 2023

@joel-costigliola I don't need both. I'll keep a getter for decomposedPath then.

@joel-costigliola joel-costigliola merged commit ce9eaa6 into assertj:main Apr 12, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: recursive comparison An issue related to the recursive comparison
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants