October 2009
Intermediate to advanced
384 pages
8h 54m
English
Although Hamcrest 1.2 comes with a large library of matchers, sometimes these do not let you specify an assertion or expectation accurately enough to convey what you mean or to keep your tests flexible. In such cases, you can easily define a new matcher that seamlessly extends the JUnit and jMock APIs.
A matcher is an object that implements the org.hamcrest.Matcher interface:

A matcher does two things:
• Reports whether a parameter value meets the constraint (the matches() method);
• Generates a readable description to be included in test failure messages (the describeTo() method inherited ...