Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 104   Methods: 5
NCLOC: 57   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ProcedureTagHandlerT.java - 100% 100% 100%
coverage
 1   
 package junit.extensions.xml.elements;
 2   
 
 3   
 import org.w3c.dom.Element;
 4   
 import junit.extensions.xml.IXMLTestCase;
 5   
 import junit.extensions.xml.IXMLTestSuite;
 6   
 import junit.extensions.xml.XMLException;
 7   
 import junit.framework.TestCase;
 8   
 import junit.extensions.xml.XMLTagResourceBundle;
 9   
 
 10   
 /**
 11   
  * <p>Title: Test ProcedureTagHandler.</p>
 12   
  * <p>Copyright: Copyright (c) 2003</p>
 13   
  * <p>Company: JFCUnit OpenSource Project</p>
 14   
  * @author Kevin Wilson
 15   
  * @version 1.0
 16   
  */
 17   
 public class ProcedureTagHandlerT
 18   
     extends TestCase {
 19   
   /**
 20   
    * test tag handler.
 21   
    */
 22   
   private ProcedureTagHandler m_tagHandler = null;
 23   
   /**
 24   
    * Test fixture.
 25   
    */
 26   
   private ElementFixture m_fixture;
 27   
 
 28   
   /**
 29   
    * Setup the test case.
 30   
    * @throws Exception may be thrown.
 31   
    */
 32  3
   protected void setUp() throws Exception {
 33  3
     super.setUp();
 34  3
     m_fixture = new ElementFixture(this);
 35   
 
 36  3
     m_fixture.setUp();
 37   
   }
 38   
 
 39   
   /**
 40   
    * Tear down the test case.
 41   
    * @throws Exception may be thrown.
 42   
    */
 43  3
   protected void tearDown() throws Exception {
 44  3
     m_tagHandler = null;
 45  3
     m_fixture.tearDown();
 46   
 
 47  3
     m_fixture = null;
 48  3
     super.tearDown();
 49   
   }
 50   
 
 51   
   /**
 52   
    * Test a procedure definition.
 53   
    * @throws XMLException may be thrown.
 54   
    */
 55  2
   public void testProcessDefine() throws XMLException {
 56  2
     Element suite = m_fixture.getSuiteElement();
 57   
 
 58  2
     Element proc = m_fixture.newChild(suite, "procedure", new String[] {
 59   
                                            "name", "testSuiteProc"
 60   
     });
 61  2
     m_fixture.newChild(proc, "property", new String[] {
 62   
                             "name", "../called",
 63   
                             "value", "true"
 64   
     });
 65   
 
 66  2
     IXMLTestSuite ts = m_fixture.getTestSuite();
 67  2
     m_tagHandler = new ProcedureTagHandler(proc, ts);
 68  2
     m_tagHandler.processElement();
 69   
 
 70  2
     Object p = ts.getProcedure("testSuiteProc");
 71  2
     assertNotNull(p);
 72   
 
 73   
   }
 74   
 
 75   
   /**
 76   
    * Test the procedure call.
 77   
    */
 78  1
   public void testProcessCall() {
 79  1
     testProcessDefine();
 80  1
     Element call = m_fixture.newElement("procedure", new String[] {
 81   
                                              "call", "testSuiteProc"
 82   
     });
 83  1
     IXMLTestCase tc = m_fixture.getTestCase();
 84  1
     m_tagHandler = new ProcedureTagHandler(call, tc);
 85   
 
 86  1
     m_tagHandler.processElement();
 87  1
     Object val = tc.getProperty("called");
 88  1
     assertEquals("true", val);
 89   
   }
 90   
 
 91   
   /**
 92   
    * Test with the Tag lookup.
 93   
    */
 94  1
   public void testLookup() {
 95  1
     Element call = m_fixture.newElement("procedure", new String[] {
 96   
                                         "call", "testSuiteProc"
 97   
     });
 98  1
     IXMLTestCase tc = m_fixture.getTestCase();
 99  1
     Object o = XMLTagResourceBundle.getTagHandler(call, tc, "procedure");
 100  1
     assertNotNull(o);
 101   
   }
 102   
 
 103   
 }
 104