What is the
Hamcrest is a framework that comes with a library of useful matchers for writing match rules using matcher objects.
The matchers are most commonly used for:
- Writing test assertions
- Data validation
Note: In Java, we use the Matcher class to search for the regular expression in a particular piece of text.
We will use
TestNG to demonstrate its usage.
Let’s take a look at the code below and its explanation in the method comments.