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
CanonicalizationExceptionTest.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.canonical.CanonicalizationException;
 25   
 26    /**
 27    * <p>
 28    * Unit tests for the <code>CanonicalizationException</code> class.
 29    * </p>
 30    *
 31    * @author Elliotte Rusty Harold
 32    * @version 1.1d7
 33    *
 34    */
 35    public class CanonicalizationExceptionTest extends XOMTestCase {
 36   
 37   
 38    private CanonicalizationException ex;
 39    private Exception cause;
 40   
 41   
 42  5 public CanonicalizationExceptionTest(String name) {
 43  5 super(name);
 44    }
 45   
 46   
 47  5 protected void setUp() {
 48  5 ex = new CanonicalizationException("message");
 49  5 cause = new Exception();
 50    }
 51   
 52   
 53  1 public void testConstructor() {
 54  1 String message = "testing 1-2-3";
 55  1 CanonicalizationException ex = new CanonicalizationException(message);
 56  1 assertEquals(message, ex.getMessage());
 57    }
 58   
 59   
 60  1 public void testInitCause() {
 61   
 62  1 assertNull(ex.getCause());
 63  1 ex.initCause(cause);
 64  1 assertEquals(cause, ex.getCause());
 65   
 66  1 try {
 67  1 ex.initCause(null);
 68  0 fail("Reinitialized cause over null");
 69    }
 70    catch (IllegalStateException success) {
 71  1 assertNotNull(success.getMessage());
 72    }
 73   
 74  1 try {
 75  1 ex.initCause(new Exception());
 76  0 fail("Reinitialized cause over null");
 77    }
 78    catch (IllegalStateException success) {
 79  1 assertNotNull(success.getMessage());
 80    }
 81   
 82    }
 83   
 84   
 85  1 public void testNullInitCause() {
 86   
 87  1 CanonicalizationException ex = new CanonicalizationException(null);
 88  1 ex.initCause(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 CanonicalizationException("testing");
 125  1 assertEquals("testing", ex.getMessage());
 126    }
 127   
 128    }