alexruiz / fest-assert-2.x

FEST Fluent Assertions 2.x
http://fest.easytesting.org
Apache License 2.0
402 stars 69 forks source link

is*EqualsToByIgnoringFields #159

Open martinsson opened 11 years ago

martinsson commented 11 years ago

It is very difficult to know what field made the assertion fail as the error message uses field values of expected and toString() on the actual. ex

java.lang.AssertionError: expected values: <[null, 0.1, null, null, null, 3, null]> in fields: <['timestampMessage', 'altitude', 'latitude', 'longitude', 'timestampMesure', 'direction', 'vitesseInstantanee']> of com.bla.bla.Localisation@2b2a653e.

I would suggest (and I'm willing to provide) the feature of printing a comparison of the fields that were used for the comparison instead. ex java.lang.AssertionError: expected values: <[null, 0.1, null, null, null, 3, null]> in fields: <['timestampMessage', 'altitude', 'latitude', 'longitude', 'timestampMesure', 'direction', 'vitesseInstantanee']> of <[null, 2.1, null, null, null, 3, null]>.

What do you think?

joel-costigliola commented 11 years ago

Yes, good idea, I would be very interested but for ... AssertJ (a fork of fest-assert-2.x).

martinsson commented 11 years ago

So I just discovered FEST has been forked. I don't know what to do or think now.

joel-costigliola commented 11 years ago

Fest is not active these days, a big refactoring is going on for month that does not seem to end, meanwhile no contribution are accepted. This is why, as an old Fest contributor, I decided to fork it (I would have preferred not to). The other reason is that the next Fest version will provide less assertions that the 2.x, which was not an option to me since I was using some of the "doomed" assertions.

Anyway using Fest or AssertJ is always better than JUnit base assertions !

martinsson commented 11 years ago

Thank you for the information and explications joel.

Where can I find information about the rationale behind the refactoring and of reducing the number of assertions?

In the meanwhile I'll provide the discussed feature in assertj in a few days.

joel-costigliola commented 11 years ago

It comes from a conversation I had with Alex (Fest creator) few months ago.

Alex is now working for Android's team and he does not have a lot of time to give to Fest (it may change in the future) he thought that reducing the number of assertions would make the project easier to maintain, his plan was to offer a small core of assertions and let users extend it, but IMHO if a user adds a new assertion it should be shared.