Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 93   Methods: 6
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
TestTagHandler.java - 100% 100% 100%
coverage
 1   
 package junit.extensions.xml.elements;
 2   
 
 3   
 import junit.extensions.xml.IXMLTestSuite;
 4   
 import junit.extensions.xml.XMLException;
 5   
 import junit.extensions.xml.XMLTestCase;
 6   
 
 7   
 import junit.framework.Test;
 8   
 
 9   
 import org.w3c.dom.Element;
 10   
 
 11   
 
 12   
 /**
 13   
  * This class will handle the processing of <test> nodes.
 14   
  * <H3>Tag Name</H3>
 15   
  * test
 16   
  *
 17   
  * <H3>Required Attributes</H3>
 18   
  * name - Name of the test case.
 19   
  * <H3>Optional Attributes</H3>
 20   
  * Other attributes may be processed by the IXMLTestCase implementation.
 21   
  *
 22   
  * <H3>Children</H3>
 23   
  * Each of the children elements are processed by the corresponding
 24   
  * tag handler.
 25   
  *
 26   
  * @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
 27   
  */
 28   
 public class TestTagHandler extends AbstractTagHandler {
 29   
     /**
 30   
      * Test Case.
 31   
      */
 32   
     protected Test m_testCase = null;
 33   
 
 34   
     /**
 35   
      * Constructor for TestTagHandler.
 36   
      *
 37   
      * @param element     The element to be processed
 38   
      * @param testSuite   The XMLTestSuite that uses this element
 39   
      */
 40  599
     public TestTagHandler(final Element element, final IXMLTestSuite testSuite) {
 41  599
         super(element, testSuite);
 42  599
         validateElement();
 43  599
         addTest();
 44   
     }
 45   
 
 46   
     /**
 47   
      * Process the children of the test case.
 48   
      * @throws XMLException may be thrown.
 49   
      */
 50  599
     public void processElement() throws XMLException {
 51   
     }
 52   
 
 53   
     /**
 54   
      * Validate that the tag name is test.
 55   
      * @throws XMLException if the tag name is not test.
 56   
      */
 57  1197
     public void validateElement() throws XMLException {
 58   
         // do the default validations from the super class
 59  1197
         super.validateElement();
 60   
 
 61   
         // check the element tag name
 62  1197
         checkElementTagName(TEST);
 63  1197
         checkRequiredAttribute(NAME);
 64   
     }
 65   
 
 66   
     /**
 67   
      * Returns the value of the NAME attribute for this element.
 68   
      * @return String  The value of the NAME attribute.
 69   
      */
 70  599
     protected String getName() {
 71  599
         return getString(NAME);
 72   
     }
 73   
 
 74   
     /**
 75   
      * This method is intended to be overridden when extending the
 76   
      * class for other test types.
 77   
      * @return Test New test instance.
 78   
      */
 79  1
     protected Test createTest() {
 80  1
         return new XMLTestCase(
 81   
             getName(),
 82   
             getElement());
 83   
     }
 84   
 
 85   
     /**
 86   
      * Add a test to the parent test suite.
 87   
      */
 88  599
     private void addTest() {
 89  599
         m_testCase = createTest();
 90  599
         getXMLTestSuite().addTest(m_testCase);
 91   
     }
 92   
 }
 93