You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
record MyRecord(int total, int used) {
MyRecord(int total, int used) {
Preconditions.checkArgument(total >= 0);
this.total = total;
Preconditions.checkArgument(used >= 0);
Preconditions.checkArgument(used <= total);
this.used = used;
}
}
@Test
public void testMyRecord() {
EqualsVerifier
.forClass(MyRecord.class)
.verify();
}
java.lang.AssertionError: EqualsVerifier found a problem in class Test$MyRecord.
-> Record: failed to run constructor for record type Test$MyRecord
These were the values passed to the constructor: [0, 1]
If the record does not accept 0 or false as a value for its constructor parameters, consider suppressing Warning.ZERO_FIELDS.
If the record does not accept any of the given values for its constructor parameters, consider providing prefab values for the types of those fields.
For more information, go to: https://www.jqno.nl/equalsverifier/errormessages
(EqualsVerifier 3.12.3, JDK 17.0.5 on Linux)
Supression suppress(Warning.ZERO_FIELDS) doesn't help as it fails with:
These were the values passed to the constructor: [1, 2]
Probably worth to create withPrefabValues() which takes a name of the constructor's field.
The text was updated successfully, but these errors were encountered:
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 withPrefabValues overload which also takes the names of the fields is interesting, but I'm not sure if it's the best solution...I'll have to think about this a little.
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: