net.sourceforge.ajaxtags.tags
Class AbstractTagTest<T extends BaseAjaxBodyTag>

java.lang.Object
  extended by net.sourceforge.ajaxtags.tags.AbstractTagTest<T>
Type Parameters:
T - tag class
Direct Known Subclasses:
AjaxAnchorsTagTest, AjaxAreaTagTest, AjaxAutocompleteTagTest, AjaxPortletTagTest, AjaxSubmitTagTest, AjaxTabPanelTagTest, AjaxToggleTagTest

public abstract class AbstractTagTest<T extends BaseAjaxBodyTag>
extends Object

Base for tag tests.

Author:
Victor Homyakov

Field Summary
protected  javax.servlet.jsp.PageContext context
          Page context.
protected  T tag
          Tag instance under tests.
 
Constructor Summary
AbstractTagTest()
           
 
Method Summary
 void assertAfterBody()
          Test body evaluation of tag.
 void assertContent(String expected)
          Asserts that page content is equal to expected.
 void assertContent(String expected, String actual)
          Asserts that two XHTML contents are equal.
 void assertEndTag()
          Test end of tag.
 void assertStartTagEvalBody()
          Test start of tag with body.
 void assertStartTagSkipBody()
          Test start of tag without body.
protected  String getContent()
           
protected  String reformat(String html)
           
 void setUp(Class<T> clazz)
          Set up.
 void tearDown()
          Tear down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tag

protected T extends BaseAjaxBodyTag tag
Tag instance under tests.


context

protected javax.servlet.jsp.PageContext context
Page context.

Constructor Detail

AbstractTagTest

public AbstractTagTest()
Method Detail

setUp

public void setUp(Class<T> clazz)
           throws Exception
Set up.

Parameters:
clazz - tag class
Throws:
Exception - if the instantiation fails

tearDown

public void tearDown()
Tear down.


assertStartTagSkipBody

public void assertStartTagSkipBody()
                            throws javax.servlet.jsp.JspException
Test start of tag without body.

Throws:
javax.servlet.jsp.JspException - if an error occurred while processing this tag

assertStartTagEvalBody

public void assertStartTagEvalBody()
                            throws javax.servlet.jsp.JspException
Test start of tag with body.

Throws:
javax.servlet.jsp.JspException - if an error occurred while processing this tag

assertAfterBody

public void assertAfterBody()
                     throws javax.servlet.jsp.JspException
Test body evaluation of tag.

Throws:
javax.servlet.jsp.JspException - if an error occurred while processing this tag

assertEndTag

public void assertEndTag()
                  throws javax.servlet.jsp.JspException
Test end of tag.

Throws:
javax.servlet.jsp.JspException - if an error occurred while processing this tag

assertContent

public void assertContent(String expected,
                          String actual)
                   throws TransformerException,
                          SAXException
Asserts that two XHTML contents are equal. Ignores different formatting.

Parameters:
expected - expected content
actual - actual content
Throws:
TransformerException - if it is not possible to transform content to string
SAXException - if any parse errors occur

assertContent

public void assertContent(String expected)
                   throws TransformerException,
                          SAXException
Asserts that page content is equal to expected. Ignores different formatting.

Parameters:
expected - expected content
Throws:
TransformerException - if it is not possible to transform content to string
SAXException - if any parse errors occur

reformat

protected String reformat(String html)
                   throws TransformerException,
                          SAXException
Throws:
TransformerException
SAXException

getContent

protected String getContent()
Returns:
the page content as string


Copyright © 2005-2010 The Ajaxtags Team. All Rights Reserved.