|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
NestedTag
is used to simulate tags with static body
content and child tags. It can be used to test the interaction
of different tags. A NestedTag
always wraps a real tag
class (the actual testee).
TagTestModule
works with NestedTag
instances
internally. If you only want to test the ouptput of one single tag
without interaction with other tags, you do not have to care about
NestedTag
. Use it, if you want to write sophisticated
tests of body tags. NestedTag
instances are created with
the help of TagTestModule.createNestedTag(java.lang.Class)
. You do not need to
create them on your own in the tests.
Method Summary | |
void |
addDynamicChild(DynamicChild child)
Adds a dynamic child simulating scriptlets and EL expressions. |
NestedTag |
addTagChild(java.lang.Class tag)
Adds a tag child simulating nested tags. |
NestedTag |
addTagChild(java.lang.Class tag,
java.util.Map attributeMap)
Adds a tag child simulating nested tags. |
NestedTag |
addTagChild(javax.servlet.jsp.tagext.JspTag tag)
Adds a tag child simulating nested tags. |
NestedTag |
addTagChild(javax.servlet.jsp.tagext.JspTag tag,
java.util.Map attributeMap)
Adds a tag child simulating nested tags. |
NestedTag |
addTagChild(javax.servlet.jsp.tagext.TagSupport tag)
Adds a tag child simulating nested tags. |
NestedTag |
addTagChild(javax.servlet.jsp.tagext.TagSupport tag,
java.util.Map attributeMap)
Adds a tag child simulating nested tags. |
void |
addTextChild(java.lang.String text)
Adds a text child simulating static body content. |
int |
doLifecycle()
Performs the tags lifecycle. |
java.lang.Object |
getChild(int index)
Returns a child specified by its index. |
java.util.List |
getChilds()
Returns the List of childs. |
javax.servlet.jsp.tagext.TagSupport |
getTag()
Returns the wrapped tag (the testee). |
javax.servlet.jsp.tagext.JspTag |
getWrappedTag()
Returns the wrapped tag (the testee). |
void |
populateAttributes()
Populates the attributes of the underlying tag. |
void |
removeChilds()
Removes all childs. |
void |
setDoRelease(boolean doRelease)
Specify if the release method should be called
before populating a tag. |
void |
setDoReleaseRecursive(boolean doRelease)
Specify if the release method should be called
before populating a tag. |
Method Detail |
public void setDoRelease(boolean doRelease)
release
method should be called
before populating a tag. Defaults to false
. It's
the container behaviour to call release
when the tag
goes back to the pool. It's usually not necessary in the tests,
because the tag instances are not pooled and reused during a test run.
Only sets the doRelease
flag for this tag and
leaves the flag for child tags.
doRelease
- should release be called, default is false
public void setDoReleaseRecursive(boolean doRelease)
release
method should be called
before populating a tag. Defaults to false
. It's
the container behaviour to call release
when the tag
goes back to the pool. It's usually not necessary in the tests,
because the tag instances are not pooled and reused during a test run.
Recursively sets the doRelease
flag for this
tag and all childs.
doRelease
- should release be called, default is false
public void populateAttributes()
public int doLifecycle() throws javax.servlet.jsp.JspException
doBody
and doTag
methods are called as in the real web container. The evaluation of the body
is simulated by performing the lifecycle recursively for all childs of the
NestedTag
.
doEndTag
call
javax.servlet.jsp.JspException
public javax.servlet.jsp.tagext.TagSupport getTag()
public javax.servlet.jsp.tagext.JspTag getWrappedTag()
public void removeChilds()
public java.util.List getChilds()
List
of childs.
List
of childspublic java.lang.Object getChild(int index)
index
- the index
public void addTextChild(java.lang.String text)
text
- the static textpublic void addDynamicChild(DynamicChild child)
TagUtil.evalBody(List, Object)
for details about child handling.
child
- the dynamic child instancepublic NestedTag addTagChild(java.lang.Class tag)
NestedTag
will be created
automatically wrapping the specified tag. An empty attribute
Map
will be used for the tag.
tag
- the tag classpublic NestedTag addTagChild(java.lang.Class tag, java.util.Map attributeMap)
NestedTag
will be created
automatically wrapping the specified tag. The attributes
Map
contains the attributes of this tag
(propertyname maps to propertyvalue).
tag
- the tag classattributeMap
- the attribute mappublic NestedTag addTagChild(javax.servlet.jsp.tagext.TagSupport tag)
NestedTag
will be created automatically
wrapping the specified tag. An empty attribute Map
will be used for the tag.
tag
- the tagpublic NestedTag addTagChild(javax.servlet.jsp.tagext.TagSupport tag, java.util.Map attributeMap)
NestedTag
will be created
automatically wrapping the specified tag. The attributes
Map
contains the attributes of this tag
(propertyname maps to propertyvalue).
tag
- the tagattributeMap
- the attribute mappublic NestedTag addTagChild(javax.servlet.jsp.tagext.JspTag tag)
NestedTag
will be created automatically
wrapping the specified tag. An empty attribute Map
will be used for the tag.
tag
- the tagpublic NestedTag addTagChild(javax.servlet.jsp.tagext.JspTag tag, java.util.Map attributeMap)
NestedTag
will be created
automatically wrapping the specified tag. The attributes
Map
contains the attributes of this tag
(propertyname maps to propertyvalue).
tag
- the tagattributeMap
- the attribute map
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |