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

Changed signature of method containsInAnyOrder to allow avoid calling… #275

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yatsenko-ihor
Copy link

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)

… 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)
@tumbarumba
Copy link
Member

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 IsIterableContainingInAnyOrderTest to verify that this doesn't cause a regression?

@nhojpatrick
Copy link
Member

@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 hamcrest-core and hamcrest-library have been refactored a lot and also deprecated, so that everything is just in hamcrest.

@nhojpatrick
Copy link
Member

Going to try and kick start hamcrest, so if you want to get it merged, please rebase from the branch v2.3-candidates.
Still trying to understand how has permissions to perform a release.

@nhojpatrick nhojpatrick force-pushed the master branch 2 times, most recently from 9bc653b to e9f7fc8 Compare February 13, 2022 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Needs triage
Development

Successfully merging this pull request may close these issues.

3 participants