jocarreira / hamcrest

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

Add support for *only* contains in collections and arrays #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Add support to collection matchers to allow one to test a collection
contains only a collection of specified elements.

Eg.

assertThat(collecton, onlyContains("foo","bar","baz"));

Original issue reported on code.google.com by neild...@gmail.com on 20 Dec 2006 at 10:21

GoogleCodeExporter commented 8 years ago
Isn't this the same as the below?

assertThat(collection, is(Array.asList("foo", "bar", "baz")));

Agreed that the Array.asList is clunky, but perhaps isCollection would be a 
better name?

Original comment by david.s...@gmail.com on 22 Dec 2006 at 4:16

GoogleCodeExporter commented 8 years ago
From what I understand, onlyContains() should not care about order, where as 
List
equality does.

Original comment by joe.wal...@gmail.com on 27 Dec 2006 at 10:37

GoogleCodeExporter commented 8 years ago
Added in revision 192

Original comment by neild...@gmail.com on 2 Aug 2007 at 2:44