November 2024
Intermediate to advanced
300 pages
7h 12m
English
JUnit provides all the assertions you’ll need, but it’s worth taking a look at the third-party assertion libraries available—AssertJ, Hamcrest, Truth, and more. These libraries primarily seek to improve upon the expressiveness of assertions, which can help streamline and simplify your tests.
Let’s take a very quick look at AssertJ, a popular choice, to see a little bit of its power. AssertJ offers fluent assertions, which are designed to help tests flow better and read more naturally. A half-dozen simple examples should get the idea across quickly. Each of the examples assumes the following declaration:
| | String name = "my big fat acct"; |
The core AssertJ form reverses JUnit order. You specify the actual value ...
Read now
Unlock full access