From: Ian R. <ian...@gm...> - 2009-08-11 17:04:10
|
Chris Hansen wrote: I am in the process of writing org.pojomatic.junit.Assert.assertEqualsWithDiff() (similarly for org.pojomatic.testng.Assert), what do you think of the name? Using Pojomatic.diff(), I found it frustrating from an end-user standpoint that null is not allowed as the first argument, which means every call has to make the annoying check first. I understand why that is the case, but I think it would be better to add behavior to Pojomatic.diff(null, x) to return something like the opposite of DifferenceToNull: "{null} is different than the object {x}". It would mean that Pojomatic.diff() has different behavior than PojomatorImpl.diff(), but the API would be much easier to use. Also, we could lift the non-null restriction from PojomatorImpl.diff() as well. What do you think? -Chris I think this makes a lot of sense. In particular, while the intended use of doEquals, doHashCode and doToString is to have them called from an instance of T, doDiff will typically be called by an external object, passing two instances in. Since doesn't change any method signatures, and doesn't reduce functionality, I see no harm in making this change. - Ian |