1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
package org.qedeq.kernel.xml.parser; |
16 |
|
|
17 |
|
import org.qedeq.base.test.QedeqTestCase; |
18 |
|
import org.qedeq.kernel.bo.test.DummyPlugin; |
19 |
|
import org.qedeq.kernel.xml.handler.common.AbstractSimpleHandler; |
20 |
|
import org.qedeq.kernel.xml.handler.common.SaxDefaultHandler; |
21 |
|
import org.qedeq.kernel.xml.handler.common.SimpleAttributes; |
22 |
|
import org.qedeq.kernel.xml.handler.module.QedeqHandler; |
23 |
|
|
24 |
|
|
25 |
|
@link |
26 |
|
|
27 |
|
@version |
28 |
|
@author |
29 |
|
|
|
|
| 85.7% |
Uncovered Elements: 4 (28) |
Complexity: 10 |
Complexity Density: 0.5 |
|
30 |
|
public class QedeqParserTest extends QedeqTestCase { |
31 |
|
|
32 |
|
|
33 |
|
private SaxParser parser1; |
34 |
|
|
35 |
|
|
36 |
|
private SaxParser parser2; |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
|
38 |
2
|
protected void setUp() throws Exception {... |
39 |
2
|
super.setUp(); |
40 |
|
{ |
41 |
2
|
SaxDefaultHandler handler = new SaxDefaultHandler(new DummyPlugin()); |
42 |
2
|
AbstractSimpleHandler simple = new AbstractSimpleHandler(handler, null) { |
43 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
44 |
105
|
public void startElement(final String name, final SimpleAttributes attributes) {... |
45 |
|
|
46 |
|
} |
47 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
48 |
105
|
public void endElement(final String name) {... |
49 |
|
|
50 |
|
|
51 |
|
} |
52 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
53 |
33
|
public void characters(final String name, final String value) {... |
54 |
|
|
55 |
|
} |
56 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
57 |
1
|
public void init() {... |
58 |
|
|
59 |
|
} |
60 |
|
|
61 |
|
}; |
62 |
2
|
handler.setBasisDocumentHandler(simple); |
63 |
2
|
parser1 = new SaxParser(DummyPlugin.getInstance(), handler); |
64 |
|
} |
65 |
|
{ |
66 |
2
|
SaxDefaultHandler handler = new SaxDefaultHandler(new DummyPlugin()); |
67 |
2
|
AbstractSimpleHandler simple = new QedeqHandler(handler); |
68 |
2
|
handler.setBasisDocumentHandler(simple); |
69 |
2
|
parser2 = new SaxParser(DummyPlugin.getInstance(), handler); |
70 |
|
} |
71 |
|
} |
72 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
73 |
2
|
protected void tearDown() throws Exception {... |
74 |
2
|
parser1 = null; |
75 |
2
|
parser2 = null; |
76 |
2
|
super.tearDown(); |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
@throws |
83 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
1
PASS
|
|
84 |
1
|
public void testParse1() throws Exception {... |
85 |
1
|
try { |
86 |
1
|
parser1.parse(getFile("qedeq.xml"), getFile("qedeq.xml").toURL().toString()); |
87 |
|
} catch (Exception e) { |
88 |
0
|
e.printStackTrace(System.out); |
89 |
0
|
throw e; |
90 |
|
} |
91 |
|
} |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
@throws |
97 |
|
|
|
|
| 50% |
Uncovered Elements: 2 (4) |
Complexity: 2 |
Complexity Density: 0.5 |
1
PASS
|
|
98 |
1
|
public void testParse2() throws Exception {... |
99 |
1
|
try { |
100 |
1
|
parser2.parse(getFile("qedeq.xml"), getFile("qedeq.xml").toURL().toString()); |
101 |
|
} catch (Exception e) { |
102 |
0
|
e.printStackTrace(System.out); |
103 |
0
|
throw e; |
104 |
|
} |
105 |
|
} |
106 |
|
} |