junit.extensions.xml.elements
Class ChooseTagHandler

java.lang.Object
  extended byjunit.extensions.xml.elements.AbstractTagHandler
      extended byjunit.extensions.xml.elements.ChooseTagHandler
All Implemented Interfaces:
XMLConstants

public class ChooseTagHandler
extends AbstractTagHandler

Title:

ChooseTagHandler

Description:

The ChooseTagHandler allows for some flow control in a test case. The handler is pattered after the xsl:choose elements.

The choose tag processes its child elements which should be either when or otherwise elements. Each when element contains a test attribute which points to a tag handler. If the tag handler does not assert, then the test is assumed to process properly. The when element is passed as the element to process to the test tag handler defined. If the when does not cause a assertion, then the test is assumed to be successful, and the child elements of the when which succeeded will be processed, and the processing of the Choose element will conclude.

If none of the When elements are tested successful, then the otherwise elements children will be processed.

Example:

 <choose>
   <when test="assertnotnull" refid="ComponentA">
     ...do when...
   </when>
   <when test="assertnotnull" refid="ComponentB">
     ...do when...
   </when>
   <otherwise>
     ...do otherwise...
   </otherwise>
 </choose>
 
"choose" element requires no attributes but should contain a ordered list of "when" elements and "otherwise".

"when" element requires one attribute "test" which defines a tag handler to be processed. Other "when" attributes may be required depending upon the tag handler specified. Children of the when should be specified which are to be conditionaly processed. "otherwise" element requires no attributes. The children elements will conditionally be processed.

Copyright: Copyright (c) 2003

Company: JFCUnit Sourceforge project

Version:
1.0
Author:
Kevin Wilson

Field Summary
private  java.lang.String m_choose
          choose string.
private  java.lang.String m_other
          other string.
private  java.lang.String m_when
          when string.
 
Fields inherited from class junit.extensions.xml.elements.AbstractTagHandler
 
Fields inherited from interface junit.extensions.xml.XMLConstants
ACTION, ACTUALOBJ, ACTUALREFID, ADD, ASSERTENABLED, ASSERTEQUALS, ASSERTNOTEQUALS, ASSERTNOTNULL, ASSERTNOTSAME, ASSERTNULL, ASSERTSAME, CALL, CASE, CHOOSE, CLASSNAME, COLUMN, CONFIRM, DEBUG, DEFAULT, DELIMITER, DIALOG, DUMP, ECHO, ENABLED, ENCODING, EVALUATE, EXPECTEDOBJ, EXPECTEDREFID, FAIL, FILE, FOCUS, FOREACH, ID, INDEX, JFCFILELOC, LESSTHAN, LISTITEM, LOG, MARK, MESSAGE, METHOD, MODE, NAME, OTHERWISE, PATHREFID, PROCEDURE, PROPERTY, RECURSIVE, REFID, RELATIVE, REMOVE, ROW, SAVE, STDERR, STDOUT, STOPWATCH, SUITE, SWITCH, TABLECELL, TAGHANDLERS, TAGNAME, TEST, TYPE, USERE, VALUE, WHEN, WHILE
 
Constructor Summary
ChooseTagHandler(org.w3c.dom.Element element, IXMLTestCase testCase)
          Constructor.
 
Method Summary
 void processElement()
          process the element.
protected  void setChoose(java.lang.String choose)
          Set the choose string.
protected  void setOther(java.lang.String other)
          Set the other string.
protected  void setWhen(java.lang.String when)
          Set the when string.
 void validateElement()
          Validate that the element is correct.
 
Methods inherited from class junit.extensions.xml.elements.AbstractTagHandler
checkAtLeastOneRequiredAttribute, checkAtLeastOneRequiredAttribute, checkElementTagName, checkOneRequiredAttribute, checkOneRequiredAttribute, checkRequiredAttribute, checkRequiredAttribute, getBoolean, getBoolean, getBoolean, getBoolean, getElement, getInt, getInt, getLong, getLong, getPoint, getPoint, getString, getString, getString, getString, getTagName, getTest, getTestCase, getXMLTestCase, getXMLTestSuite, resolveVariables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_choose

private java.lang.String m_choose
choose string.


m_other

private java.lang.String m_other
other string.


m_when

private java.lang.String m_when
when string.

Constructor Detail

ChooseTagHandler

public ChooseTagHandler(org.w3c.dom.Element element,
                        IXMLTestCase testCase)
Constructor.

Parameters:
element - Element to be processed.
testCase - Test case processing tag handler.
Method Detail

processElement

public void processElement()
                    throws XMLException
process the element.

Specified by:
processElement in class AbstractTagHandler
Throws:
XMLException - is thrown if the element cannot be understood.

validateElement

public void validateElement()
                     throws XMLException
Validate that the element is correct.

Overrides:
validateElement in class AbstractTagHandler
Throws:
XMLException - may be thrown.

setChoose

protected void setChoose(java.lang.String choose)
Set the choose string.

Parameters:
choose - Choose string to be used.

setOther

protected void setOther(java.lang.String other)
Set the other string.

Parameters:
other - string to be used.

setWhen

protected void setWhen(java.lang.String when)
Set the when string.

Parameters:
when - When string to be used.


Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999