net.sourceforge.sqlunit.handlers
Class CategoryHandler

java.lang.Object
  extended by net.sourceforge.sqlunit.handlers.CategoryHandler
All Implemented Interfaces:
IHandler

public class CategoryHandler
extends java.lang.Object
implements IHandler

The CategoryHandler processes the contents of a Category tag in the input SQLUnit XML file. It decides whether a test falls into a user-defined category, which we will call the global category. The decision is made following these rules:

  1. If the current test's category tags is not present or is empty, the test matches and is executed;
  2. If the global category is not set, the test matches and is executed;
  3. The contents of the current test's category tag is parsed as a comma separated list and a check is made whether the global category matches (in the terms of regular expession matching) at least one element of that list. If it matches, the test then falls in the given global category.
The global category is provided in one of the following ways, sorted by priority:

Version:
$Revision: 1.5 $
Author:
Ivan Ivanov

Constructor Summary
CategoryHandler()
           
 
Method Summary
 java.lang.Object process(org.jdom.Element elCategory)
          Processes the JDOM Element representing a Category Declaration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CategoryHandler

public CategoryHandler()
Method Detail

process

public java.lang.Object process(org.jdom.Element elCategory)
                         throws java.lang.Exception
Processes the JDOM Element representing a Category Declaration.

Specified by:
process in interface IHandler
Parameters:
elCategory - the JDOM Element to use.
Returns:
a Boolean.TRUE if Category matches the test category, else Boolean.FALSE. Caller must cast appropriately. If category is not specified globally, then it is ignored.
Throws:
if - there was a problem handling the category element.
java.lang.Exception - if something went wrong with the process call.