Recent changes to the junit tag library (inclusion of line number in error
message and modified exception hierarchy) rendered my patch-test.txt
invalid. My local copy was not uptodate with the CVS repository. Here is
the new patch for the test suite which replaces the old patch.
--
knut
Index: suite.jelly
===================================================================
RCS file:
/home/cvspublic/jakarta-commons-sandbox/jelly/src/test/org/apache/commons/jelly/junit/suite.jelly,v
retrieving revision 1.7
diff -u -r1.7 suite.jelly
--- suite.jelly 27 Nov 2002 19:13:25 -0000 1.7
+++ suite.jelly 28 Nov 2002 10:21:58 -0000
@@ -51,6 +51,48 @@
<log:info>The exception was: ${ex.message}</log:info>
</test:case>
+
+ <test:case name="assertThrownTests">
+
+ <!-- test using var attribute -->
+ <test:assertThrown var="ex">
+ <test:fail message="This exeption should be exported"/>
+ </test:assertThrown>
+ <test:assert test="${ex != null}">No exception exported</test:assert>
+
+ <!-- test using superclass of expected throwable -->
+ <test:assertThrown expectedThrowable="java.lang.Exception">
+ <test:fail message="This should always fail"/>
+ </test:assertThrown>
+
+ <!-- test using non exception class -->
+ <test:assertThrown expectedThrowable="java.lang.Class">
+ <test:fail message="This should always fail"/>
+ </test:assertThrown>
+
+ <!-- test using undefined class -->
+ <test:assertThrown expectedThrowable="foo.bar.Baz">
+ <test:fail message="This should always fail"/>
+ </test:assertThrown>
+
+ <!-- test using other exception class -->
+ <j:catch var="ex">
+ <test:assertThrown expectedThrowable="java.io.IOException">
+ <test:fail message="This should always fail"/>
+ </test:assertThrown>
+ </j:catch>
+ <test:assert test="${ex != null}">We should have created an
+exception</test:assert>
+
+ <!-- test with no exception from body -->
+ <j:catch var="ex">
+ <test:assertThrown>
+ </test:assertThrown>
+ </j:catch>
+ <test:assert test="${ex != null}">We should have created an
+exception</test:assert>
+ <test:assert test="${ex.message.startsWith('No exception was thrown.')}"/>
+
+ </test:case>
+
<!--
#### uncomment when assertEquals supports type conversions
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>