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

Create Iterable/Collection matcher like: doesNotContainAnyOf(T [] items) #195

Open
Vitalik549 opened this issue Mar 12, 2018 · 1 comment · May be fixed by #338
Open

Create Iterable/Collection matcher like: doesNotContainAnyOf(T [] items) #195

Vitalik549 opened this issue Mar 12, 2018 · 1 comment · May be fixed by #338

Comments

@Vitalik549
Copy link

Vitalik549 commented Mar 12, 2018

Case:

List<String> list = Arrays.asList("a", "b", "c");
String[] cd = {"c", "d"};

assertThat("Should not contain each item", list, not(hasItems(cd)));

This assertion won't fail. I understand why it will pass, though it's not expected by most of users.

It would be nice to have simple Matcher to check that "every item is not in the list"

# Now it's possible to use:
assertThat("Should not contain each item", list, everyItem(not(isIn(cd))));

# But that looks much better:
assertThat("Should not contain each item", list,  doesNotContainAnyOf(cd));
@XxxXxxXxx233 XxxXxxXxx233 linked a pull request Apr 25, 2021 that will close this issue
@XxxXxxXxx233
Copy link

Hello. I implemented a method to check whether two Iterables intersect and submitted a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants