Clover coverage report - JFCUnit Test Coverage
Coverage timestamp: Mon Dec 20 2004 23:38:10 MST
file stats: LOC: 266   Methods: 16
NCLOC: 149   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
AbstractAssertTagHandlerT.java - 100% 93.8% 99%
coverage 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.XMLException;
 6   
 import junit.framework.TestCase;
 7   
 
 8   
 /**
 9   
  * <p>Title: Test the AbstractAssertTagHandler.</p>
 10   
  * <p>Copyright: Copyright (c) 2003</p>
 11   
  * <p>Company: JFCUnit OpenSource Project</p>
 12   
  * @author Kevin Wilson
 13   
  * @version 1.0
 14   
  */
 15   
 public class AbstractAssertTagHandlerT extends TestCase {
 16   
 
 17   
   /**
 18   
    * <p>Title: Implementation class for AbstractAssertTagHandler.</p>
 19   
    * <p>Copyright: Copyright (c) 2003</p>
 20   
    * <p>Company: JFCUnit OpenSource Project</p>
 21   
    * @author Kevin Wilson not attributable
 22   
    * @version 1.0
 23   
    */
 24   
   private class ImplAssertTagHandler extends AbstractAssertTagHandler {
 25   
     /**
 26   
      * Constructor.
 27   
      * @param element Element defining the assert.
 28   
      * @param tc IXMLTestCase parent test case.
 29   
      */
 30  12
     public ImplAssertTagHandler(final Element element, final IXMLTestCase tc) {
 31  12
       super(element, tc);
 32   
     }
 33   
 
 34   
     /**
 35   
      * Process the element. Provided to complete the interface.
 36   
      */
 37  0
     public void processElement() {
 38   
     }
 39   
   }
 40   
 
 41   
   /**
 42   
    * Test tag handler.
 43   
    */
 44   
   private AbstractAssertTagHandler m_abstractAssertTagHandler = null;
 45   
   /**
 46   
    * Test fixture.
 47   
    */
 48   
   private ElementFixture m_fixture;
 49   
 
 50   
   /**
 51   
    * Setup the test.
 52   
    * @throws Exception may be thrown.
 53   
    */
 54  12
   protected void setUp() throws Exception {
 55  12
     super.setUp();
 56  12
     m_fixture = new ElementFixture(this);
 57  12
     m_fixture.setUp();
 58   
   }
 59   
 
 60   
   /**
 61   
    * Tear down the test.
 62   
    * @throws Exception may be thrown.
 63   
    */
 64  12
   protected void tearDown() throws Exception {
 65  12
     m_abstractAssertTagHandler = null;
 66  12
     m_fixture.tearDown();
 67  12
     m_fixture = null;
 68   
 
 69  12
     super.tearDown();
 70   
   }
 71   
 
 72   
   /**
 73   
    * Check the actual value given a refid.
 74   
    * @throws XMLException may be thrown.
 75   
    */
 76  1
   public void testCheckActualID() throws XMLException {
 77  1
     IXMLTestCase tc = m_fixture.getTestCase();
 78  1
     Element e = m_fixture.newElement("impltest", new String[] {
 79   
                                           "actualrefid", "abc"
 80   
     });
 81   
 
 82  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 83  1
     m_abstractAssertTagHandler.checkActual();
 84   
   }
 85   
 
 86   
   /**
 87   
    * Check the actual value given a object.
 88   
    * @throws XMLException may be thrown.
 89   
    */
 90  1
   public void testCheckActualObj() throws XMLException {
 91  1
     IXMLTestCase tc = m_fixture.getTestCase();
 92  1
     Element e = m_fixture.newElement("impltest", new String[] {
 93   
                                           "actualobj", "abc"
 94   
     });
 95   
 
 96  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 97  1
     m_abstractAssertTagHandler.checkActual();
 98   
   }
 99   
 
 100   
   /**
 101   
    * Check actual when both the id and obj are missing.
 102   
    * @throws XMLException may be thrown.
 103   
    */
 104  1
   public void testCheckActualException() throws XMLException {
 105  1
     IXMLTestCase tc = m_fixture.getTestCase();
 106  1
     Element e = m_fixture.newElement("impltest", new String[] {
 107   
     });
 108   
 
 109  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 110   
 
 111  1
     XMLException exception = null;
 112  1
     try {
 113  1
       m_abstractAssertTagHandler.checkActual();
 114   
     } catch (XMLException ex) {
 115  1
       exception = ex;
 116   
     }
 117   
 
 118  1
     assertNotNull("Exception was not thrown", exception);
 119  1
     assertSame(e, exception.getElement());
 120   
   }
 121   
 
 122   
   /**
 123   
    * Check the expected id.
 124   
    * @throws XMLException may be thrown.
 125   
    */
 126  1
   public void testCheckExpectedID() throws XMLException {
 127  1
     IXMLTestCase tc = m_fixture.getTestCase();
 128  1
     Element e = m_fixture.newElement("impltest", new String[] {
 129   
                                           "expectedrefid", "data"
 130   
     });
 131   
 
 132  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 133  1
     m_abstractAssertTagHandler.checkExpected();
 134   
   }
 135   
 
 136   
   /**
 137   
    * Check the expected object.
 138   
    * @throws XMLException may be thrown.
 139   
    */
 140  1
   public void testCheckExpectedObj() throws XMLException {
 141  1
     IXMLTestCase tc = m_fixture.getTestCase();
 142  1
     Element e = m_fixture.newElement("impltest", new String[] {
 143   
                                           "expectedobj", "data"
 144   
     });
 145   
 
 146  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 147  1
     m_abstractAssertTagHandler.checkExpected();
 148   
   }
 149   
 
 150   
   /**
 151   
    * Check the expected object when both the refid and obj are missing.
 152   
    * @throws XMLException may be thrown.
 153   
    */
 154  1
   public void testCheckExpectedException() throws XMLException {
 155  1
     IXMLTestCase tc = m_fixture.getTestCase();
 156  1
     Element e = m_fixture.newElement("impltest", new String[] {
 157   
     });
 158   
 
 159  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 160  1
     XMLException exception = null;
 161  1
     try {
 162  1
       m_abstractAssertTagHandler.checkExpected();
 163   
     } catch (XMLException ex) {
 164  1
       exception = ex;
 165   
     }
 166  1
     assertNotNull("Exception not thrown", exception);
 167  1
     assertSame(e, exception.getElement());
 168   
   }
 169   
 
 170   
   /**
 171   
    * Get the actual id.
 172   
    */
 173  1
   public void testGetActualID() {
 174  1
     IXMLTestCase tc = m_fixture.getTestCase();
 175  1
     Element e = m_fixture.newElement("impltest", new String[] {
 176   
                                           "actualrefid", "data"
 177   
     });
 178   
 
 179  1
     tc.addProperty("data", "abc");
 180  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 181  1
     Object expectedReturn = "abc";
 182  1
     Object actualReturn = m_abstractAssertTagHandler.getActualObject();
 183  1
     assertEquals("return value", expectedReturn, actualReturn);
 184   
   }
 185   
 
 186   
   /**
 187   
    * Get the actual object.
 188   
    */
 189  1
   public void testGetActualObject() {
 190  1
     IXMLTestCase tc = m_fixture.getTestCase();
 191  1
     Element e = m_fixture.newElement("impltest", new String[] {
 192   
                                           "actualobj", "abc"
 193   
     });
 194   
 
 195  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 196  1
     Object expectedReturn = "abc";
 197  1
     Object actualReturn = m_abstractAssertTagHandler.getActualObject();
 198  1
     assertEquals("return value", expectedReturn, actualReturn);
 199   
   }
 200   
 
 201   
   /**
 202   
    * get the expected object.
 203   
    */
 204  1
   public void testGetExpectedObject() {
 205  1
     IXMLTestCase tc = m_fixture.getTestCase();
 206  1
     Element e = m_fixture.newElement("impltest", new String[] {
 207   
                                           "expectedobj", "abc"
 208   
     });
 209   
 
 210  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 211  1
     Object expectedReturn = "abc";
 212  1
     Object actualReturn = m_abstractAssertTagHandler.getExpectedObject();
 213  1
     assertEquals("return value", expectedReturn, actualReturn);
 214   
   }
 215   
 
 216   
   /**
 217   
    * Test get the expected id.
 218   
    */
 219  1
   public void testGetExpectedID() {
 220  1
     IXMLTestCase tc = m_fixture.getTestCase();
 221  1
     Element e = m_fixture.newElement("impltest", new String[] {
 222   
                                           "expectedrefid", "data"
 223   
 
 224   
     });
 225   
 
 226  1
     tc.addProperty("data", "abc");
 227   
 
 228  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 229  1
     Object expectedReturn = "abc";
 230  1
     Object actualReturn = m_abstractAssertTagHandler.getExpectedObject();
 231  1
     assertEquals("return value", expectedReturn, actualReturn);
 232   
   }
 233   
 
 234   
   /**
 235   
    * Test getMessage.
 236   
    */
 237  1
   public void testGetMessage() {
 238  1
     IXMLTestCase tc = m_fixture.getTestCase();
 239  1
     Element e = m_fixture.newElement("impltest", new String[] {
 240   
                                           "message", "abc"
 241   
 
 242   
     });
 243   
 
 244  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 245  1
     String expectedReturn = "abc";
 246  1
     String actualReturn = m_abstractAssertTagHandler.getMessage();
 247  1
     assertEquals("return value", expectedReturn, actualReturn);
 248   
   }
 249   
 
 250   
   /**
 251   
    * Test getRefid.
 252   
    */
 253  1
   public void testGetRefId() {
 254  1
     IXMLTestCase tc = m_fixture.getTestCase();
 255  1
     Element e = m_fixture.newElement("impltest", new String[] {
 256   
                                           "refid", "abc"
 257   
     });
 258   
 
 259  1
     m_abstractAssertTagHandler = new ImplAssertTagHandler(e, tc);
 260  1
     String expectedReturn = "abc";
 261  1
     String actualReturn = m_abstractAssertTagHandler.getRefId();
 262  1
     assertEquals("return value", expectedReturn, actualReturn);
 263   
   }
 264   
 
 265   
 }
 266