|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jelly.TagSupport
org.apache.commons.jelly.xpath.XPathTagSupport
org.apache.commons.jelly.tags.junit.AssertTagSupport
org.apache.commons.jelly.tags.junit.AssertThrowsTag
public class AssertThrowsTag
Runs its body and asserts that an exception is thrown by it. If no
exception is thrown the tag fails. By default all exceptions are caught.
If however expected
was specified the body must throw
an exception of the given class, otherwise the assertion fails. The
exception thrown by the body can also be of any subtype of the specified
exception class. The optional var
attribute can be specified if
the caught exception is to be exported to a variable.
Field Summary | |
---|---|
private java.lang.ClassLoader |
classLoader
Sets the ClassLoader to be used when loading an exception class |
private java.lang.String |
expected
The class name (fully qualified) of the exception expected to be thrown by the body. |
private static org.apache.commons.logging.Log |
log
The Log to which logging calls will be made. |
private java.lang.String |
var
The variable name to export the caught exception to. |
Fields inherited from class org.apache.commons.jelly.TagSupport |
---|
body, context, hasTrimmed, parent, shouldTrim |
Constructor Summary | |
---|---|
AssertThrowsTag()
|
Method Summary | |
---|---|
void |
doTag(org.apache.commons.jelly.XMLOutput output)
|
java.lang.ClassLoader |
getClassLoader()
|
protected java.lang.Class |
getThrowableClass()
Returns the Class corresponding to the class
specified by expected . |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the class loader to be used to load the exception type |
void |
setExpected(java.lang.String expected)
Sets the class name of exception expected to be thrown by the body. |
void |
setVar(java.lang.String var)
Sets the variable name to define for this expression. |
Methods inherited from class org.apache.commons.jelly.tags.junit.AssertTagSupport |
---|
fail, fail, failNotEquals |
Methods inherited from class org.apache.commons.jelly.xpath.XPathTagSupport |
---|
getXPathContext |
Methods inherited from class org.apache.commons.jelly.TagSupport |
---|
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final org.apache.commons.logging.Log log
private java.lang.String var
private java.lang.String expected
private java.lang.ClassLoader classLoader
Constructor Detail |
---|
public AssertThrowsTag()
Method Detail |
---|
public void doTag(org.apache.commons.jelly.XMLOutput output) throws org.apache.commons.jelly.JellyTagException
org.apache.commons.jelly.JellyTagException
public void setExpected(java.lang.String expected)
java.lang.Throwable
.
public void setVar(java.lang.String var)
public void setClassLoader(java.lang.ClassLoader classLoader)
public java.lang.ClassLoader getClassLoader()
protected java.lang.Class getThrowableClass() throws java.lang.ClassNotFoundException
Class
corresponding to the class
specified by expected
. If
expected
was either not specified then java. lang.
Throwable
is returned.
Otherwise if the class couldn't be
found or doesn't denote an exception class then an exception is thrown.
java.lang.ClassNotFoundException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |