From: Curt S. <cj...@cy...> - 2002-04-08 07:35:06
|
On Thu, 4 Apr 2002, Dossy wrote: > However, ComparisonAssertFailedError's construtor would > need to call super("some message") and what that message > should be needs to be determined at the time the > assertion is thrown, not when it's displayed. Why can't this message be just the message given to the assert method? I.e., you invoke assertEquals("It's a foo.", "foo", "bar); This would throw a ComparisonAssertFailedError containing: message: "It's a foo" expected: "foo" actual: "bar location: [a stack trace] And whatever catches this is responsible for appropriately displaying the contents above. > Perhaps one could create ComparisonAssertionFailedError > as I suggest, and implement getMessage() to return the long > message, and getAbbreviatedMessage() to return the > abbreviated message the way Alex's patch abbreviates it. It seems to me that whether the message is long or abbreviated doesn't belong there, because that's display stuff, not anything particular to the assertion itself. Maybe you're using a GUI that displays the actual and expected in side-by-side scrolling text panels that highlight the differences in colour. In that case, this whole long versus abbreviated thing makes no difference, hmmm? cjs -- Curt Sampson <cj...@cy...> +81 90 7737 2974 http://www.netbsd.org Don't you know, in this new Dark Age, we're all light. --XTC |