Re: ExpectedException: expecting a cause's message
Matthew Farwell <[email protected]> Wed, 31 Jul 2013 17:43:02 +0200
| Newsgroups | gmane.comp.java.junit.user |
|---|---|
| Message-ID | <CAOBkoFWn=9TUCf69uGor60cMV-zYbpZ+7cfmg-121bSMA43w4Q@mail.gmail.com> |
There are a couple of use cases for testing messages that I've come across. The first is where the error message transmits important information or advice. For instance, we require the unlimited strength cryptography for Java, and we want a specific message to appear in the logs if it isn't installed. We have a specific message for this case. The second is where we don't have control over the exception - it isn't us that raises it, and the message is the only differentiator between two different messages. Matthew Farwell. On 31 Jul 2013 00:07, "Charlie Poole" <[email protected]> wrote: > As a general rule, I only test the messages of exceptions I'm creating and > throwing myself, in languages that support it. And then only to test that > I'm setting the message correctly. > > Charlie > > > On Tue, Jul 30, 2013 at 3:33 AM, Tomek Kaczanowski < > [email protected]> wrote: > > > ** > > > > > > please try http://code.google.com/p/catch-exception/ instead of anything > > that unit testing frameworks provide > > > > P.S. Agreed with Colin: there are only rare cases when testing exc > message > > is the right thing to do. > > > > -- > > Regards / Pozdrawiam > > Tomek Kaczanowski > > http://practicalunittesting.com > > > > > > [Non-text portions of this message have been removed] > > > > > > > > > [Non-text portions of this message have been removed] > > > > ------------------------------------ > > Yahoo! Groups Links > > > > [Non-text portions of this message have been removed]