jocarreira / hamcrest

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

Simplify the usage of Matchers.empty() #132

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently it is nearly not possible to use #empty() as a static import, because 
of its generic return type.

Currently we have to write something like this in a JUnit-Testcase...

Set<String> strings = ...
assertThat(strings, is(Matchers.<String>empty());

it is easier to read if we could use a static import...

Set<String> strings = ...
assertThat(strings, is(empty());

this could be done if IsEmptyCollection#empty() would look like this..

public static Matcher<Collection<?>> empty(){
 return new IsEmptyCollection();
}

Original issue reported on code.google.com by chriss....@gmail.com on 27 Dec 2010 at 10:17

GoogleCodeExporter commented 8 years ago
duplicate of issue 97

Original comment by MatrixFrog on 2 Jul 2011 at 1:39

GoogleCodeExporter commented 8 years ago
tagging

Original comment by t.denley on 12 May 2012 at 10:43

GoogleCodeExporter commented 8 years ago
Duplicate issue 97 has now been fixed, hence so has this one.

Original comment by t.denley on 20 May 2012 at 4:13