When you write your unit tests you must use some kind of assertions. I think that most of you will agree with me on that the asserts that comes with the JUnit aren’t the easiest and most readable ones.
So, some time ago I started to use a Hamcrest matcher library. It was a great progress, as I was able to move away from JUnit’s unintuitive:
assertEquals(11.0, actual). I mean, if you try to read it out loud it doesn’t seem very logical:
“assert equals 11 is
“assert equals 11 as
expected value is the first argument and the
actual one is the latter which also makes it harder to understand.
And here comes the
*Hamcrest* matcher which brings a fluent API consisting of a lot of useful methods.