junit.extensions.xml.elements
Class AssertTableContainsTagHandler

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

public class AssertTableContainsTagHandler
extends AbstractTagHandler

Provide a mechanism for validating the contents of a table.

Tag Name:

asserttablecontains

Attributes:

 id      - the table to inspect                            [required]
 value   - the expected value                              [required]
 row     - the row to inspect                              [required]
 col     - the column to inspect (int index or column name)[required]
 useRE   - allow the value to contain a regular expression [optional]
           default - is false exact string match needed
           If set to true partial strings will work.
 

Examples:

<assertTableContains id="component1" value="Joe"/>

Author:
Kevin Wilson

Field Summary
 
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
AssertTableContainsTagHandler(org.w3c.dom.Element element, IXMLTestCase testcase)
          Constructor.
 
Method Summary
 int getColumn(javax.swing.JTable table)
          Get the column index from the attibute column.
private  int getColumnIndex(java.lang.String columnName, javax.swing.JTable table)
          Get the column index matching the name.
 void processElement()
          Handle the XML processing of the tag 'assertTableContains'.
 void validateElement()
          Insure that the required attributes are specified.
 
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
 

Constructor Detail

AssertTableContainsTagHandler

public AssertTableContainsTagHandler(org.w3c.dom.Element element,
                                     IXMLTestCase testcase)
Constructor.

Parameters:
element - Element to be processed.
testcase - TestCase containing the element.
Method Detail

getColumn

public int getColumn(javax.swing.JTable table)
Get the column index from the attibute column. The attribute value may be a integer index of the column. Or the name of the column according to the table model.

Parameters:
table - JTable containing the data.
Returns:
index of the column.

processElement

public void processElement()
                    throws XMLException
Handle the XML processing of the tag 'assertTableContains'.

Specified by:
processElement in class AbstractTagHandler
Throws:
XMLException - when assert fails.

validateElement

public void validateElement()
                     throws XMLException
Insure that the required attributes are specified.

Overrides:
validateElement in class AbstractTagHandler
Throws:
XMLException - if a required attribute is missing.

getColumnIndex

private int getColumnIndex(java.lang.String columnName,
                           javax.swing.JTable table)
Get the column index matching the name.

Parameters:
columnName - Name of the column.
table - JTable Table to search.
Returns:
int index of the column.


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