Skip to content

Add getters for field path in ComparisonDifference - #3007

Merged
joel-costigliola merged 1 commit into
assertj:mainfrom
aakatov:getters-comparison-difference
Apr 12, 2023
Merged

joel-costigliola merged 1 commit into
assertj:mainfrom
aakatov:getters-comparison-difference

Conversation

@aakatov

@aakatov aakatov commented Mar 30, 2023

Copy link
Copy Markdown
Contributor

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

scordio commented Mar 30, 2023

Copy link
Copy Markdown
Member

Would you have a concrete use case to share?

@aakatov

aakatov commented Mar 30, 2023

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown
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

aakatov commented Apr 12, 2023

Copy link
Copy Markdown
Contributor Author

@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
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.

3 participants