Use custom Hamcrest Matchers to level-up your tests
Ideally automated tests should be predictable, isolated and precise, allowing you to find an issue quickly. If these conditions are met, you’ll never have to change a test unless to accommodate a changed requirement. This sounds great on paper, but in practice we often forget the isolated bit and start testing multiple things in a single test. If abused, we’ll end up with tests that need updating all the time, causing developer frustration and wasting time.
One tool that can help with isolation of tests is using matchers. As the name suggests, matchers allow you to match an object agains certain conditions.