As suggested by
http://monkeyisland.pl/2010/07/26/expected-exception-in-tests/#comment-3859
catch-exception could provide an additional API that is consistent with the
syntax of Mockito and BDDMockito.
Suggestions:
{{{
when(foo).bar();
thenThrown(RuntimeException.class);
or:
//given
…
//then
thrown(RuntimeException.class).when(foo).bar();
//sort of consistent with Mockito api:
verifyThrown(RuntimeException.class).when(foo).bar();
verifyThrown(messageContains(“foo”)).when(foo).bar();
}}}
Original issue reported on code.google.com by rwoo@gmx.de on 30 Oct 2011 at 7:05
Original issue reported on code.google.com by
rwoo@gmx.de
on 30 Oct 2011 at 7:05