Answer to Question #114012 in Java | JSP | JSF for DeadBeast

Question #114012
Briefly (i.e., in no more than 2 sentences) describe the benefit(s) of using Hamcrest (i.e., "assertThat" and associated matchers) over "assertTrue", "assertFalse" and "assertEquals."
1
Expert's answer
2020-05-05T18:34:51-0400

The benefits of using Hamcrest:

  • assertThat is more readable than the other assert methods,
  • much better error messages,
  • generic and type-safe.

An additional benefit to hamcrest library is its portability.  It can be used with both JUnit and TestNG. 

In the same way that custom assert methods can be written, custom matcher can also be written.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS