Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 111   Methods: 5
NCLOC: 64   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AssertSameTagHandlerT.java - 100% 100% 100%
coverage
 1   
 package junit.extensions.xml.elements;
 2   
 
 3   
 import java.awt.Point;
 4   
 
 5   
 import org.w3c.dom.Element;
 6   
 import junit.extensions.xml.IXMLTestCase;
 7   
 import junit.extensions.xml.XMLException;
 8   
 import junit.framework.AssertionFailedError;
 9   
 import junit.framework.TestCase;
 10   
 import junit.extensions.xml.XMLTagResourceBundle;
 11   
 
 12   
 /**
 13   
  * <p>Title: Test AssertSameTagHandler.</p>
 14   
  * <p>Copyright: Copyright (c) 2003</p>
 15   
  * <p>Company: JFCUnit OpenSource Project</p>
 16   
  * @author Kevin Wilson
 17   
  * @version 1.0
 18   
  */
 19   
 
 20   
 public class AssertSameTagHandlerT
 21   
     extends TestCase {
 22   
   /**
 23   
    * Test tag handler.
 24   
    */
 25   
   private AssertSameTagHandler m_tagHandler = null;
 26   
 
 27   
   /**
 28   
    * Test fixture.
 29   
    */
 30   
   private ElementFixture m_fixture;
 31   
 
 32   
   /**
 33   
    * Setup the test.
 34   
    * @throws Exception may be thrown.
 35   
    */
 36  3
   protected void setUp() throws Exception {
 37  3
     super.setUp();
 38  3
     m_fixture = new ElementFixture(this);
 39   
 
 40  3
     m_fixture.setUp();
 41   
   }
 42   
 
 43   
   /**
 44   
    * Tear down the test.
 45   
    * @throws Exception may be thrown.
 46   
    */
 47  3
   protected void tearDown() throws Exception {
 48  3
     m_tagHandler = null;
 49  3
     m_fixture.tearDown();
 50   
 
 51  3
     m_fixture = null;
 52  3
     super.tearDown();
 53   
   }
 54   
 
 55   
   /**
 56   
    * Same.
 57   
    * @throws XMLException may be thrown.
 58   
    */
 59  1
   public void testProcessElement() throws XMLException {
 60  1
     IXMLTestCase tc = m_fixture.getTestCase();
 61  1
     Element e = m_fixture.newElement("assertsame", new String[] {
 62   
                                      "actualrefid", "data1",
 63   
                                      "expectedrefid", "data2"
 64   
     });
 65  1
     m_tagHandler = new AssertSameTagHandler(e, tc);
 66  1
     Point p1 = new Point(0, 0);
 67  1
     tc.addProperty("data1", p1);
 68  1
     tc.addProperty("data2", p1);
 69  1
     m_tagHandler.processElement();
 70   
   }
 71   
 
 72   
   /**
 73   
    * Different.
 74   
    * @throws XMLException may be thrown.
 75   
    */
 76  1
   public void testProcessElement2() throws XMLException {
 77  1
     IXMLTestCase tc = m_fixture.getTestCase();
 78  1
     Element e = m_fixture.newElement("assertsame", new String[] {
 79   
                                      "actualrefid", "data1",
 80   
                                      "expectedrefid", "data2"
 81   
     });
 82  1
     m_tagHandler = new AssertSameTagHandler(e, tc);
 83  1
     Point p1 = new Point(0, 0);
 84  1
     Point p2 = new Point(0, 0);
 85  1
     tc.addProperty("data1", p1);
 86  1
     tc.addProperty("data2", p2);
 87   
 
 88  1
     AssertionFailedError err = null;
 89  1
     try {
 90  1
       m_tagHandler.processElement();
 91   
     } catch (AssertionFailedError afe) {
 92  1
       err = afe;
 93   
     }
 94  1
     assertNotNull("Exception not thrown", err);
 95   
   }
 96   
 
 97   
   /**
 98   
    * Test the Lookup.
 99   
    */
 100  1
   public void testLookup() {
 101  1
     Element element = m_fixture.newElement("assertsame", new String[] {
 102   
                                            "actualrefid", "data1",
 103   
                                            "expectedrefid", "data2"});
 104  1
     IXMLTestCase testCase = m_fixture.getTestCase();
 105  1
     Object o = XMLTagResourceBundle.getTagHandler(element, testCase,
 106   
                                                   "assertsame");
 107  1
     assertNotNull(o);
 108   
   }
 109   
 
 110   
 }
 111