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

Add option to AreIn to perform a strict test and return false if the collection is null or empty #280

Closed
n3101 opened this issue Aug 30, 2022 · 3 comments · Fixed by #296
Assignees
Labels
enhancement Improvement to existing functionality/feature good first issue Small, lower complexity and doesn't require pre-existing Koryphe knowledge
Milestone

Comments

@n3101
Copy link

n3101 commented Aug 30, 2022

AreIn tests whether supplied values are all in a given collection, but also returns true if the collection is null or empty. This behaviour was intended - it is tested for and documented. The rationale for this has been lost.

Retain this as the default behaviour, but add an option to perform the strict test and return false if null or empty

@n3101 n3101 added this to the v2_backlog milestone Aug 30, 2022
@t92549 t92549 added enhancement Improvement to existing functionality/feature good first issue Small, lower complexity and doesn't require pre-existing Koryphe knowledge labels Oct 13, 2022
@t92549
Copy link
Contributor

t92549 commented Oct 13, 2022

The implementation lives here:

public boolean test(final Collection<?> input) {
return null == allowedValues || allowedValues.isEmpty() || (null != input && allowedValues.containsAll(input));

Some kind of option could be added to change this, similar to how orEqualTo is used in IsLessThan:

@shlokam
Copy link
Contributor

shlokam commented Oct 18, 2022

@n3101 @t92549 Can you assign this issue to me?

@n3101
Copy link
Author

n3101 commented Oct 18, 2022

@shlokam I certainly can. Welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing functionality/feature good first issue Small, lower complexity and doesn't require pre-existing Koryphe knowledge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants