Fest Assertions 2.0M3 release

19 views
Skip to first unread message

Joel Costigliola

unread,
May 8, 2012, 5:49:45 PM5/8/12
to easyt...@googlegroups.com
Hi,

Fest Assertions 2.0M3 has been released, it is available in maven central here :
http://search.maven.org/#artifactdetails|org.easytesting|fest-assert-core|2.0M3|jar

New and noteworthy in 2.0M3

Assertions class has been enriched to be a single entry point for all assertions related features
It offers access to "offset" (for comparing double or float) and "index"

FEST-404 : Filter API on iterable/array

We offer some way to filter a group of objects before making assertions ...
... by introspecting properties :
assertThat(filter(fellowshipOfTheRing).with("race", HOBBIT).get()).containsOnly(sam, frodo, pippin, merry);
... or with a Condition :
assertThat(filter(players).being(potentialMvp).get()).containsOnly(rose, james);
see the doc here : https://github.com/alexruiz/fest-assert-2.x/wiki/Tips-and-tricks#wiki-filters

- FEST-470 : Lenient Equals (allows specifying on which properties equality should be performed)

Example :
// Except name and age, frodo and sam both are hobbits, so they are lenient equals ignoring name and age
assertThat(frodo).isLenientEqualsToByIgnoringFields(sam, "name", "age");

Have a look at method basic_assertions_with_lenient_equals_examples() in BasicAssertionsExamples.java from fest-examples project to see what is possible with lenient equals.

- FEST-447 : Increase ComparableAssert API flexibility
- FEST-478 : Add support for parametrized types in AbstractAssert
- FEST-221 : Array and Iterable new assertion : hasSameSizeAs
- FEST-481 : isIn() and isNotIn() assertions should take Iterable<?> instead of Collection<?>
- github#17 : DateAssert isNotBetween error message must be improved
- github#13 : Improve error messages on group of objects assertions

In the error message, the group of objects is displayed on a new line making it easier to compare what was expected and what was got.
One example :

[Test] expecting:
<['Yoda', 'Han']>
 to contain only:
<['Luke', 'Yoda']>
 elements not found:
<['Luke']>
 and elements not expected:
<['Han']>

Thanks to :
- Nicolas Francois for implementing FEST-470, FEST-481 and FEST-221
- Mikhail Mazursky for FEST-478

Good assertions !
Cheers,

Joel



Reply all
Reply to author
Forward
0 new messages