-
Notifications
You must be signed in to change notification settings - Fork 76
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
Relation between two values in the constructor #747
Comments
also more complicated bean:
|
Thanks for reporting this, this is indeed a problem that I don't have a solution for at the moment... Your suggestion for adding a |
Hey hey there, any news on this? java.lang.AssertionError: EqualsVerifier found a problem in class ExampleTest$Example.
-> Significant fields: equals does not use value, or it is stateless.
For more information, go to: https://www.jqno.nl/equalsverifier/errormessages
(EqualsVerifier 3.16.2, JDK 21.0.3 running on classpath, on Mac OS X) |
Sorry for the long radio silence on this. However, this issue has been on my mind. I agree with @mazurkin that adding an overload to |
I can totally see that. I'm happy to help if possible, but I would totally understand if you want to do such a change on your lib by yourself. |
Thanks for the offer! Normally I would totally take you up on that, but indeed in this case it might not be practical, unfortunately |
Believe it or not, I have a solution for this issue. I've just released version 3.17, which adds a method 'withPrefabValuesForField()` that you can use to come up with prefab values for a specific field, and that field alone. This will make it possible to enforce invariants like these. You have to make sure when using multiple parameters that depend on each other, that the first ones work together, and the second ones do too. So for the OP's example, that would look like:
As you can see, 10 and 8 go together, as do 20 and 18. I'm planning on adding another feature soon-ish, which should make this even easier, but for now this should work. |
Works perfectly! Thank you very much |
Simple test of the simple record
Supression
suppress(Warning.ZERO_FIELDS)
doesn't help as it fails with:Probably worth to create
withPrefabValues()
which takes a name of the constructor's field.The text was updated successfully, but these errors were encountered: