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

...usingRecursiveComparison().ignoringTransientFields()... #3355

Open
jchambers-crescendo opened this issue Feb 3, 2024 · 7 comments
Open
Assignees
Labels
theme: recursive comparison An issue related to the recursive comparison

Comments

@jchambers-crescendo
Copy link

Feature summary

Pretty much the title, I would find it very convenient to be able to simple exclude fields based on their modifier, such as transient in my current use case, but why not any given set of modifiers?

Example

Could be as in title, or something like:

assertThat(actual).usingRecursiveComparison().ignoringFieldsWithModifiers(int modifiers);

This could be the same structure of int that java.lang.reflect.Modifier takes.

Just an idea, and seems straightforward. Thanks for listening! :)

@pbacz
Copy link
Contributor

pbacz commented Feb 26, 2024

@scordio I can add this if you think it is worth it.

@scordio scordio added the theme: recursive comparison An issue related to the recursive comparison label Feb 26, 2024
@scordio
Copy link
Member

scordio commented Feb 26, 2024

Thanks for the offer, @pbacz! Paging @joel-costigliola here

@joel-costigliola
Copy link
Member

Since there are not so many modifiers that seems relevant to ignore besides transiert (volatile maybe, but I can't really see a use case for it) then I would prefer to simply add ignoringTransientFields() which is a bit easier to discover that ignoringFieldsWithModifiers

We can add ignoringFieldsWithModifiers later if we find a real use case for it.

@joel-costigliola
Copy link
Member

@pbacz are you still interested contributing it ?

@pbacz
Copy link
Contributor

pbacz commented Apr 2, 2024

@joel-costigliola Yes, I'd like to contribute.

@joel-costigliola
Copy link
Member

Cool, thanks @pbacz

@pbacz
Copy link
Contributor

pbacz commented Apr 2, 2024

@joel-costigliola @scordio
What would be the expected behavior when:

  • a field is transient in actual but not in expected
  • a field is transient in expected but not in actual?

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

No branches or pull requests

4 participants