Skip to content

I20240109-1800

@HeikoKlare HeikoKlare tagged this 09 Jan 15:24
Comprehensive assertions can be defined with different libraries, of
which Hamcrest and AssertJ are two of the most popular ones. While
Platform tests currently only use Hamcrest at some places, AssertJ has
several advantages including:
* Easier to apply and learn due to fluent API rather than matcher
providing comprehensive code completion support
* Higher expressiveness by easily chaining multiple assertions on the
same object
* Better comprehensibility by chaining instead of nesting calls and
starting `assertThat` always with the subject under test and not a
custom message in case such a message is desired

This change migrates the existing usages of Hamcrest to AssertJ (except
for one custom Matcher implementation). Doing that it also makes use of
String formatting rather than String concatenation with a potential
slight performance improvement.
Assets 2
Loading