Skip to content
Advertisement

Assert that actual value is in a collection of possible expected values

Is there a way to assert that an actual value equals any of a number of values?

Example:

JavaScript

I can see that I can just swap the arguments around:

JavaScript

but that reverses the semantics. I’m not checking if permittedTransformations is correct; I’m checking actual.

Advertisement

Answer

You can map the set elements to individual Matcher<String> objects, and combine them with either:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement