Re: ExpectedException: expecting a cause's message

David Saff <[email protected]> Mon, 29 Jul 2013 20:39:23 -0400
Newsgroups gmane.comp.java.junit.user
Message-ID <CALrw-PxPk94GnukL+guiiUCrha+14kZ4EyOc7D2UDDG43yXO5g@mail.gmail.com>
I think the ideal solution would be

expectedException.expectCause(hasMessage(...));

expectCause already exists.  hasMessage also exists, but it's currently in
an internal package.  You could submit a patch to bring it into a public
package; it might be an even better long-term solution to contribute it to
hamcrest, so the matcher can be used in other places.

   David Saff



On Mon, Jul 29, 2013 at 6:44 PM, mikecodeawesome <[email protected]> wrote:

> **
>
>
> Using ExpectedException, how would one go about expecting a cause's
> message? I can't figure out a way of doing this.
>
> Assuming I'm not missing an obvious solution, I'm thinking about
> contributing something like ExpectedException.expectCauseMessage().
>
> Thought I'd post before I do so.
>
>  
>


[Non-text portions of this message have been removed]