is it possible to write in Java AssertJ multi-conditions assertion which will pass if at least one of conditions met? (similar to OR operator)
I want something like this:
assertThat(listOfStrings)
.satisfiesAnyOf(
a -> Assertions.assertThat(listItem).matches(someRegex),
// OR
b -> Assertions.assertThat(listItem).equals(someString)
);
Assertion which will receive List of strings and will check each element of list against Regex and equals another string, all elements of list should satisfy at least one of conditions, and in that case - assertion should pass.
Any help greatly appreciated!
Tried a lot of options but none of them works perfectly.
here we are. you can fit
containsandmatchesRegexmethods in variables, as you like !that you can combine as you wish, like this