> On Fri, Jun 26, 2009 at 9:39 AM, jweiss <jeffrey.m.we...@gmail.com> wrote:
>> Hi,
>> I am starting to use the "expectedExceptions" annotation to test (for
>> instance) invalid input to my application.
>> The problem I'm having is that I want something printed to stdout that
>> when I expect an exception and didn't get one, I want to see what
>> exception was expected. I have an implementation of IResultListener,
>> ISuiteListener that can print the throwable when in fact the test
>> passes with the expected exception, but I can't handle the case where
>> the test fails. TestNG just prints that it expected an exception, but
>> doesn't say which one(s).
> Ah, it looks like the error message is okay when no exception is thrown:
> Method test.tmp.A.f() should have thrown an exception of class
> java.lang.NumberFormatException
> But when the wrong exception is thrown, it's not very verbose:
> FAILED: f
> java.lang.RuntimeException
> at test.tmp.A.f(A.java:37)
> I agree that for the second case, the message should be "Expected
> NumberFormatException, but got RuntimeException".
> Is this what you're asking?
> --
> ***Cédric
> *