liangzai-cool / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

unlucky naming for some factory methods #153

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The naming of the four factory methods

isIn
isOneOf
isEmptyString
isEmptyOrNullString

is unlucky, isn't it?
How do you negate them?

assertThat(1, not(isIn(collection)))?
assertThat(1, is(not(isIn(collection))))?

wouldn't it be more correct to write

assertThat(1, is(not(in(collection))))?

The same holds true for the other three in the list.

Additionall for the last one, "emptyOrNullString", wouldn't it be more correct 
to name it either "emptyStringOrNull" or "nullOrEmptyString"?

Original issue reported on code.google.com by vampi...@gmail.com on 28 May 2011 at 1:31

GoogleCodeExporter commented 9 years ago
I think the same could be said of pretty much any factory method that starts 
with 'is'

Original comment by MatrixFrog on 2 Jul 2011 at 7:18

GoogleCodeExporter commented 9 years ago
Iirc I looked through all of them and those 4 were the only ones starting with 
"is". But of course, if there are more it holds true for those also.

Original comment by vampi...@gmail.com on 2 Jul 2011 at 1:17

GoogleCodeExporter commented 9 years ago

Original comment by smgfree...@gmail.com on 25 Apr 2012 at 11:25

GoogleCodeExporter commented 9 years ago
I've deprecated the four factory methods you mention, and provided alternatives 
without the "is" prefix.  This will go out in the next release, and the 
deprecated methods will be removed in the one after.

See 
https://github.com/hamcrest/JavaHamcrest/commit/8d25c2cd24a317df2b6e4eb1f5d8e1b4
5d1c79a5 for the actual changes.

Original comment by t.denley on 29 Jul 2012 at 9:39