Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Current »

FEST Assertions Module has moved to Github !

Check this page :

The documentation below is for Fest 1.x which is no more maintained, we are focusing our effort to the 2.x version !


Hamcrest is a powerful library for writing custom matchers. Although FEST-Assert and Hamcrest have similar goals, their implementation and APIs are quite different. Here is an example using Hamcrest (borrowed from Martin Gilday's example posted at the TestNG mailing list):

This is the same example, using FEST's assertions:

We like FEST-Assert's approach because:

  1. Only one static import is needed (org.fest.assertions.Assertions.assertThat)
  2. Allows us to use our IDE's "auto-complete" feature: we only type "." and we get the possible assertion methods for the value passed to assertThat
  3. We can chain related assertion methods:

Which one to use? Hamcrest or FEST-Assert? It is up to depends on the needs of your project and your coding style!

  • No labels