-
Notifications
You must be signed in to change notification settings - Fork 21
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
TextIs should test asString(), toString(), equals() and hashCode() #199
Comments
@fabriciofx yes, I agree. And also, if someone just want to test that two Text are equal without the extra checks, they can use the IsEqual matcher. For the record, this ticket comes from a discussion there: yegor256/cactoos#1472. |
@fabriciofx I agree with all but |
@llorllale I was wondering also about |
@victornoel no one should rely on Are we thinking about formatting strings using |
@llorllale I see your point. I'm a bit confused about the meaning of |
This issue was also brought up here yegor256/cactoos#1485 (comment) @fabriciofx Btw, Also, should 1: https://github.com/llorllale/cactoos-matchers/blob/master/src/main/java/org/llorllale/cactoos/matchers/TextHasString.java |
@andreoss just reacting about the point about equals: every implementation of text could/should implement it. You don't have to rely on TextOf for that. It's not ideal and it's not 100% clear if the text interface contract should include equals and hashcode but for now, it seems to be the case... |
Actually,
TextIs
matcher just checks if twoText#asString()
are equals. IMHO, to twoText
are truly equals,asString()
,toString()
,equals()
andhashCode()
must be equals, because:asString() and
toString()` are the same thing, should be equals;equals()
must be equals too;hashCode()
is closely linked toequals()
, bothhashCode()
should be equals too.So, @victornoel and @llorllale WDYT?
The text was updated successfully, but these errors were encountered: