Changed signature of method containsInAnyOrder to allow avoid calling…#275
Changed signature of method containsInAnyOrder to allow avoid calling…#275yatsenko-ihor wants to merge 1 commit intohamcrest:masterfrom
Conversation
… toArray() method or casting to array and build next construction
List<String> actual = Arrays.asList("a", "b", "c");
List<String> expected = Arrays.asList("a", "c");
assertThat(list, containsInAnyOrder(expected))
Some results from internet with reccomendations to call toArray():
https://stackoverflow.com/questions/21624592/hamcrest-compare-collections
http://haroonzone.github.io/comparing-lists-with-hamcrest/ (ListMatcher2.java)
|
I really like they way that this simplifies the calling code for collections of items. Without knowing if this is true, I also worry that this will break other code that is passing collections of matchers. Can you add another test to |
|
@yatsenko-ihor looking at closing pr and getting merged, looks a good idea can you keep the current signature but mark as deprecated as i'm sure if we do this change we might get bugs as a result if people are using existing signature please can you rebase from master, as |
|
Going to try and kick start hamcrest, so if you want to get it merged, please rebase from the branch |
9bc653b to
e9f7fc8
Compare
Changed signature of method containsInAnyOrder to allow avoid calling toArray() method or casting to the array and build next construction
List actual = Arrays.asList("a", "b", "c");
List expected = Arrays.asList("a", "c");
assertThat(list, containsInAnyOrder(expected))
Some results from the internet with recommendations to call toArray():
https://stackoverflow.com/questions/21624592/hamcrest-compare-collections
http://haroonzone.github.io/comparing-lists-with-hamcrest/ (ListMatcher2.java)