Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: FEST-Assert 1.1
-
Fix Version/s: FEST-Assert 1.2
-
Component/s: Assert
-
Labels:None
-
Number of attachments :
Description
FEST currently uses ComparisonFailure when doing isEqualTo with Strings. ComparisonFailure has some extra benefits in modern IDEs, e.g. Eclipse offers extra pop-up info with detailed comparison highlighting the differences.
I propose to use this exception for isEqualTo on other types as well. It could work like this:
- assertThat(foo).isEqualTo(foo2);
- if the assertion fails
- if the foo.toString() is not equal to foo2.toString() then throw new ComparisonFailure(foo.toString(), foo2.toString())
- if the foo.toString() is equal to foo2.toString() then DON'T throw ComparisonFailure because it is confusing
- assertion doesn't fail. Good for you.
This is a proposal and if you guys think it is useful the please stick it into November release. I think it is useful because on the occasion I remember I temporarily refactored assertions into assertEquals(expected.toString(), actual.toString()) just to have nicer message ![]()
I fixed this issue some time ago, but I forgot to create an issue for it.