Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99063

AssertJ Java: multiple conditions assertion

$
0
0

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.


Viewing all articles
Browse latest Browse all 99063

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>