Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 71   Methods: 3
NCLOC: 22   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AssertNotNullTagHandler.java - 100% 100% 100%
coverage
 1   
 package junit.extensions.xml.elements;
 2   
 
 3   
 import junit.extensions.xml.IXMLTestCase;
 4   
 import junit.extensions.xml.XMLException;
 5   
 
 6   
 import junit.framework.Assert;
 7   
 
 8   
 import org.w3c.dom.Element;
 9   
 
 10   
 
 11   
 /**
 12   
  * This class will handle the processing of <assertnotnull> nodes.
 13   
  * Insures that the actualobject specified is not null.
 14   
  *
 15   
  * <H3>Summary</H3>
 16   
  * assertnotnull [message="message text"] actualrefid="id"|actualobject="value"
 17   
  *
 18   
  * <H3>One of the following attributes is required:</H3>
 19   
  *   actualrefid  id of object to be checked.<br>
 20   
  *   actualobject Value to be check.
 21   
  *
 22   
  * <H3>Optional Attributes:</H3>
 23   
  *   message       Optional message text to be specified.
 24   
  *
 25   
  * <H3>Depricated Attributes:</H3>
 26   
  * The following attributes have been depricated:<br>
 27   
  *   refid replaced by actualrefid
 28   
  *
 29   
  * @author <a href="mailto:vraravam@thoughtworks.com">Vijay Aravamudhan : ThoughtWorks Inc.</a>
 30   
  */
 31   
 public class AssertNotNullTagHandler extends AbstractAssertTagHandler {
 32   
     /**
 33   
      * Constructor for AssertNotNullTagHandler.
 34   
      *
 35   
      * @param element     The element to be processed
 36   
      * @param testCase    The IXMLTestCase that uses this element
 37   
      */
 38  6
     public AssertNotNullTagHandler(final Element element,
 39   
         final IXMLTestCase testCase) {
 40  6
         super(element, testCase);
 41   
     }
 42   
 
 43   
     /**
 44   
      * The actual value is obtained and then asserted to
 45   
      * insure that the value is not null.
 46   
      *
 47   
      * @throws XMLException may be thrown.
 48   
      */
 49  4
     public void processElement() throws XMLException {
 50  4
         validateElement();
 51   
 
 52  4
         String tagName = getElement().getNodeName();
 53  4
         Assert.assertNotNull(
 54   
             getMessage(),
 55   
             getActualObject());
 56   
     }
 57   
 
 58   
     /**
 59   
      * Insure that the element contains a actual attribute.
 60   
      * @throws XMLException if this tag handler does not have the required
 61   
      * attributes.
 62   
      */
 63  4
     public void validateElement() throws XMLException {
 64   
         // do the default validations from the super class
 65  4
         super.validateElement();
 66   
 
 67   
         // reqd attribute: refid
 68  4
         checkActual();
 69   
     }
 70   
 }
 71