Closed JakeWharton closed 10 years ago
For now we can check equality manually. We should file a bug on b.android.com about this as well.
Add a private static equals method in the assertion which takes two instances. Or you can also compare the toString output, but I like that a lot less.
Okay, I have opened a bug for this.
The problem with a manual equality check is that getPopulation()
method is not public. However this attribute must be involved in the comparison. Using reflection is not a case, am I right?
So 2 options remain:
toString()
outputsequals(...)
method will be addded in the upcoming releasesUse toString for now. Thanks for filing and for the work. I'll take a look at the rest later. On Aug 3, 2014 12:00 PM, "Melnykov Oleksandr" notifications@github.com wrote:
Okay, I have opened a bug https://code.google.com/p/android/issues/detail?id=74434&thanks=74434&ts=1407091929 for this.
The problem with a manual equality check is that getPopulation() method is not public. However this attribute must be involved in the comparison. Using reflection is not a case, am I right?
So 2 options remain:
- compare toString() outputs
- wait until the equals(...) methid will be addded in the upcoming releases
— Reply to this email directly or view it on GitHub https://github.com/square/assertj-android/issues/109#issuecomment-50999444 .
Isn't there a equalsByComparingFields
in assertj?
Yes, it has isEqualToComparingFieldByField
method(and some other modifications), however it compares only accessible fields values. In our case getPopulation()
is not accesible getter (it has the package-private visibility).
Hi @JakeWharton. I implemented the Palette support library module, but the problem occured: the
PaletteItem
class doesn't override theequals
method. So for example assertion:fails with the error for equal colors:
How to handle this?