commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: [PATCH] [jelly] new <test:assertThrown/> tag
Date Thu, 28 Nov 2002 13:16:19 GMT
From: "Wannheden, Knut" <>
> Hi,
> Here is an addition to the Jelly tag library junit.  It includes the tag
> <test:assertThrown/> which is used to assert that an exception is thrown
> its body.  The patch consists of the two attachments patch-java.txt and
> patch-test.txt.  The first includes the class implementing the new tag and
> the changes to the tag library class, whereas the second includes
> to the junit tag library test suite to test the new tag.  For
> refer to the Javadoc and the examples in the test suite.

Great stuff Knut.

I've just committed your patch to CVS. I made 2 minor tweaks before
committing it.

* rather than expectedThrowable="..." I renamed the attribute to
expected="...". I though this would save typing and make the tag more
polymorphic with the assertEquals and assertDocumentEquals tags.  (If there
is such a thing as polymorphic tags ;-)

* if an exception class couldn't be found, rather than eating up the
exception I've left it to bubble up; then ClassPath errors can be found more

* I made a minor patch to avoid the use of Class.forName(), which is
considered evil...

and instead use both a customizable ClassLoader as well as defaulting to
either the class loader that loaded the tag library or the current threads
context class loader. Going forward it'd be nice to generalize all use of
ClassLoaders in Jelly scripts by using a nested <classLoader> tag, along
similar lines to Rod's recent patch. There's a few tags that are
ClassLoader-aware so it should be possible to do I think. I've created a new
task so we don't forget to do this...

Thanks again for another good patch.


Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message