Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
21   69   4   5.25
0   33   0.19   4
4     1  
1    
 
  XmlSyntaxExceptionTest       Line # 24 21 4 100% 1.0
 
  (2)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15    package org.qedeq.kernel.xml.common;
16   
17    import org.qedeq.base.test.QedeqTestCase;
18   
19    /**
20    * Testing {@link XmlSyntaxException}.
21    *
22    * @author Michael Meyling
23    */
 
24    public class XmlSyntaxExceptionTest extends QedeqTestCase {
25   
 
26  2 toggle protected void setUp() throws Exception {
27  2 super.setUp();
28    }
29   
 
30  2 toggle protected void tearDown() throws Exception {
31  2 super.tearDown();
32    }
33   
34    /**
35    * Test creator.
36    *
37    * @throws Exception Something bad happened.
38    */
 
39  1 toggle public void testCreator() throws Exception {
40  1 XmlSyntaxException xse = XmlSyntaxException.createUnexpectedTagException("blueBerry");
41  1 assertNull(xse.getCause());
42  1 assertEquals(XmlSyntaxException.UNEXPECTED_TAG_CODE, xse.getErrorCode());
43  1 RuntimeException re = new NullPointerException();
44  1 xse = XmlSyntaxException.createByRuntimeException(re);
45  1 assertEquals(XmlSyntaxException.PROGRAMMING_ERROR_CODE, xse.getErrorCode());
46  1 assertEquals(re, xse.getCause());
47  1 xse = XmlSyntaxException.createEmptyAttributeException("TAGGG", "Attribute");
48  1 assertEquals(XmlSyntaxException.EMPTY_ATTRIBUTE_CODE, xse.getErrorCode());
49  1 assertNull(xse.getCause());
50  1 xse = XmlSyntaxException.createMissingAttributeException("TAAAG", "attribuTE");
51  1 assertEquals(XmlSyntaxException.MISSING_ATTRIBUTE_CODE, xse.getErrorCode());
52  1 assertNull(xse.getCause());
53  1 xse = XmlSyntaxException.createUnexpectedTextDataException("tag", "ATTRIBUTE");
54  1 assertEquals(XmlSyntaxException.UNEXPECTED_DATA_CODE, xse.getErrorCode());
55  1 assertNull(xse.getCause());
56    }
57   
58    /**
59    * Test getter.
60    *
61    * @throws Exception Something bad happened.
62    */
 
63  1 toggle public void testGetter() throws Exception {
64  1 XmlSyntaxException xse = XmlSyntaxException.createUnexpectedTagException("blueBerry");
65  1 assertNull(xse.getCause());
66  1 assertEquals(XmlSyntaxException.UNEXPECTED_TAG_CODE, xse.getErrorCode());
67    }
68   
69    }