Clover coverage report - Clover results for XOM 1.2d1
Coverage timestamp: Wed Feb 8 2006 08:31:33 EST
file stats: LOC: 128   Methods: 7
NCLOC: 69   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
XSLExceptionTest.java - 85.3% 100% 87.8%
coverage coverage
 1    /* Copyright 2003-2005 Elliotte Rusty Harold
 2   
 3    This library is free software; you can redistribute it and/or modify
 4    it under the terms of version 2.1 of the GNU Lesser General Public
 5    License as published by the Free Software Foundation.
 6   
 7    This library is distributed in the hope that it will be useful,
 8    but WITHOUT ANY WARRANTY; without even the implied warranty of
 9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 10    GNU Lesser General Public License for more details.
 11   
 12    You should have received a copy of the GNU Lesser General Public
 13    License along with this library; if not, write to the
 14    Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 15    Boston, MA 02111-1307 USA
 16   
 17    You can contact Elliotte Rusty Harold by sending e-mail to
 18    elharo@metalab.unc.edu. Please include the word "XOM" in the
 19    subject line. The XOM home page is located at http://www.xom.nu/
 20    */
 21   
 22    package nu.xom.tests;
 23   
 24    import nu.xom.xslt.XSLException;
 25   
 26    /**
 27    * <p>
 28    * Unit tests for the <code>XSLException</code> class.
 29    * </p>
 30    *
 31    * @author Elliotte Rusty Harold
 32    * @version 1.1d2
 33    *
 34    */
 35    public class XSLExceptionTest extends XOMTestCase {
 36   
 37   
 38    private XSLException ex;
 39    private Exception cause;
 40   
 41   
 42  5 public XSLExceptionTest(String name) {
 43  5 super(name);
 44    }
 45   
 46   
 47  5 protected void setUp() {
 48  5 ex = new XSLException("message");
 49  5 cause = new Exception();
 50    }
 51   
 52   
 53  1 public void testConstructor() {
 54  1 String message = "testing 1-2-3";
 55  1 XSLException ex = new XSLException(message, cause);
 56  1 assertEquals(message, ex.getMessage());
 57  1 assertEquals(cause, ex.getCause());
 58    }
 59   
 60   
 61  1 public void testInitCause() {
 62   
 63  1 assertNull(ex.getCause());
 64  1 ex.initCause(cause);
 65  1 assertEquals(cause, ex.getCause());
 66   
 67  1 try {
 68  1 ex.initCause(null);
 69  0 fail("Reinitialized cause over null");
 70    }
 71    catch (IllegalStateException success) {
 72  1 assertNotNull(success.getMessage());
 73    }
 74   
 75  1 try {
 76  1 ex.initCause(new Exception());
 77  0 fail("Reinitialized cause over null");
 78    }
 79    catch (IllegalStateException success) {
 80  1 assertNotNull(success.getMessage());
 81    }
 82   
 83    }
 84   
 85   
 86  1 public void testNullInitCause() {
 87   
 88  1 XSLException ex = new XSLException(null, null);
 89  1 assertNull(ex.getCause());
 90   
 91  1 try {
 92  1 ex.initCause(new Exception());
 93  0 fail("Reinitialized cause over null");
 94    }
 95    catch (IllegalStateException success) {
 96  1 assertNotNull(success.getMessage());
 97    }
 98   
 99  1 try {
 100  1 ex.initCause(null);
 101  0 fail("Reinitialized cause over null");
 102    }
 103    catch (IllegalStateException success) {
 104  1 assertNotNull(success.getMessage());
 105    }
 106   
 107    }
 108   
 109   
 110  1 public void testSelfCause() {
 111   
 112  1 try {
 113  1 ex.initCause(ex);
 114  0 fail("Allowed self-causation");
 115    }
 116    catch (IllegalArgumentException success) {
 117  1 assertNotNull(success.getMessage());
 118    }
 119   
 120    }
 121   
 122   
 123  1 public void testGetMessage() {
 124  1 Exception ex = new XSLException("testing");
 125  1 assertEquals("testing", ex.getMessage());
 126    }
 127   
 128    }