FEST Assertions Module has moved to Github !
The documentation below is for Fest 1.x which is no more maintained, we are focusing our effort to the 2.x version !
...
FEST-Assert is a Java library that provides a fluent interface for writing assertions. Its main goal is to improve test code readability and make maintenance of tests easier.
FEST-Assert requires Java SE 5.0 or later and can be used with either JUnit or TestNG.
Currently, this module provides assertions for the following data types:
ObjectStringCollectionMap- Primitives (
boolean, int, char, etc.) - Arrays of
Object - Arrays of primitives
BufferedImageThrowableFileBigDecimal
It can be downloaded here. For Maven 2 users, details about the project's repository can be found at here.
We have written a migration guide to easily replace JUnit assertions with Fest assertions. Note that FEST & JUnit assertions can coexist together, you don't have to migrate all in one time.
Examples
Some simple example to start.
import static org.fest.assertions.Assertions.assertThat;
int removed = employees.removeFired();
assertThat(removed).isZero();
List<Employee> newEmployees = employees.hired(TODAY);
assertThat(newEmployees).hasSize(6)
.contains(frodo, sam);
String[] newHires = employees.newHiresNames();
assertThat(newHires).containsOnly("Gandalf", "Arwen", "Gimli");
assertThat(yoda).isInstanceOf(Jedi.class)
.isEqualTo(foundJedi)
.isNotEqualTo(foundSith);
|
Extending Extending FEST-Assert with custom conditions and assertions.
|
|
More Examples Examples that how more complex usages of our assertions.
|
|