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

name of is() #21

Open
dsaff opened this issue Jun 9, 2011 · 3 comments
Open

name of is() #21

dsaff opened this issue Jun 9, 2011 · 3 comments

Comments

@dsaff
Copy link
Owner

dsaff commented Jun 9, 2011

Hamcrest used is() for equality (and overloaded it for isInstanceOf). I think obj == obj is (should be) a rare enough assertion (in situations where it differs from obj.equals(obj)) that it deserves a longer name than obj.equals(obj).

Can we make is() a shorthand for isEqualTo, and make the current is() isTheSameAs(), or some such? I think we should have both longer aliases, anyway, for people who want to be explicit.

@cgruber
Copy link
Contributor

cgruber commented Jun 10, 2011

Just to clarify - you're suggesting that we have is() exist, but simply delegate to isEqualTo(), hten make isTheSameAs() or isExactly()?

I'm ok with that, except that the english meaning of "is" is identity, and I don't want to confuse things... but frankly it's all confused already.

I used "isA()" for instanceof, since that's a common O-O phrase.

In principle, I"m ok with this, though I'm tempted to ditch is() altogether as too misleading. I just can't bring myself to lose it as a terse nice word in the phrasing of tests. :(

@dsaff
Copy link
Owner Author

dsaff commented Jun 13, 2011

Yes, I'm saying that people coming from hamcrest are used to seeing is(), but in hamcrest, is === isEqualTo. I would argue that in Java, it's good practice to thing of .equals as being "real equality", and == as an implementation detail that sometimes accidentally coincides with "real equality"

@cgruber
Copy link
Contributor

cgruber commented Jun 13, 2011

I'll buy that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants