We have just released the 0.2.0 version of the assertj-vavr library. With this release, you get the assertions for Vavr’s Multimap type, a bunch of new ones for Map, the next two for Either, and assumptions for all supported Vavr types. Let’s got through them in more detail.
While the support of Maps was already there, we’ve been missing methods allowing us to check for containment of specific keys or values. The new version of the library makes it possible:
If we are using a map that has a consistent iteration order (like LinkedHashMap or TreeMap), there is new assert allowing to check the order of entries:
Additionally, we can check whether an entry with given key satisfies provided condition:
The new release adds support of Multimap types. The range of assertions we can make is the same as for Map:
New Either assertions
EitherAssert gets two new methods checking whether a value on left or right satisfies provided criteria:
The new release adds assumptions for all supported Vavr types. The starting point is
org.assertj.vavr.api.VavrAssumptions class and its
assumeThat static methods. The API matches the one for assertions. We can now write conditional tests, as presented below. Failing assumption marks a given test as ignored, not as failed.
With this release, we have updated the error message when calling
TryAssert.isSuccess() fails. Now, the output is more informative and presents the content of the Try.Failure instance, we’ve been checking.
A big thank you go to Alex Dukhno and James Lorenzen for providing PRs and ideas on how to extend the library. And last but not least, special thanks go to Maciek Opala for competent reviews all of my PRs made to the project!
As you may spot, I released the previous version almost nine months ago. That’s a long time. Unfortunately, I had not enough free time to sit down on the project. And it doesn’t look like it is going to change shortly. Thus, if you have any idea on how to extend the project, do not hesitate and make an issue. Or even better – create a pull request. Your contribution is more than welcome!