jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robertson, Jason" <Jason.Robert...@acs-inc.com>
Subject RE: how to test an exception?
Date Tue, 10 Dec 2002 16:47:12 GMT
I use this pattern:

try {
	// code that should throw exception
	fail("Didn't throw exception!");
catch (Exception e) {}


-----Original Message-----
From: SainTiss [mailto:saintiss@gmx.net]
Sent: Tuesday, December 10, 2002 11:45 AM
To: Cactus Mailing
Subject: how to test an exception?


I thought there'd be an assertXXX method to test that an exception
should be thrown, but I can't find any...

Or is there another "nice" way to test it?

I mean, I can do this:

	// codeThatShouldThrowException
catch(exception) {}


But that doesn't look very pretty to me, does it?

I noticed that there is an ExceptionTestCase in JUnit, but I'm not sure
if this is available in Cactus as well?



To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message