concept assertion in category junit

This is an excerpt from Manning's book JUnit in Action.
This test method makes a long, hard-to-read assertion #3. (Maybe the assertion itself is not too hard to read, but what it does definitely is not obvious at first glance.) The goal is to simplify the assertion made in the test method.

This is an excerpt from Manning's book JUnit in Action, Second Edition.
JUnit provides many other methods, such as assertArrayNotEquals, assertNot-Same, assertNotTrue, and so on. It also provides the same methods with a different signature—without the message parameter. It’s a best practice to provide an error message for all your assert method calls. Recall Murphy’s Law and apply it here; when an assertion fails, describe what went wrong in a human-readable message.
When you’re writing a test case, your focus is on the test case logic; assertions are just an accessory. For example, if you need to assert that a variable is greater than a certain number, your first instinct is to write something like assertTrue(x>42). Such assertions work fine when the condition holds true, but when it fails, all you get is a junit.framework.AssertionFailedError: null message, which is far from clear. A second approach would be to include a message in the assertion, such as assertTrue("X should be greater than 42, but it is "+x, x>42). Sure, the clarity is improved but at the cost of productivity: you now need to create a long string, which contains the name of the variable (X), the operand (greater), and the current value concatenated, which is not only boring but also error prone. A better approach would be to have an assertion method specialized in comparisons, which would make it as simple as assertGreaterThan(x, 42).
JUnit provides a handful of assertions out of the box through the org.junit.Assert class, and although such features cover the basic needs, they come up short in some particular cases, such as comparing collections or properties in a JavaBean (not to mention the example in the previous paragraph). Fortunately, many third-party libraries provide complementary assertions, and in this section we analyze a few of them.