1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.qedeq.kernel.xml.tracker; |
17 |
|
|
18 |
|
import java.io.File; |
19 |
|
|
20 |
|
import org.qedeq.base.io.SourceArea; |
21 |
|
import org.qedeq.base.test.QedeqTestCase; |
22 |
|
import org.qedeq.base.trace.Trace; |
23 |
|
|
24 |
|
|
25 |
|
@link |
26 |
|
|
27 |
|
@author |
28 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (21) |
Complexity: 4 |
Complexity Density: 0.24 |
|
29 |
|
public class XPathLocationParserTest extends QedeqTestCase { |
30 |
|
|
31 |
|
|
32 |
|
private static final Class CLASS = XPathLocationParserTest.class; |
33 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
34 |
1
|
protected void setUp() throws Exception {... |
35 |
1
|
super.setUp(); |
36 |
|
} |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
1
|
protected void tearDown() throws Exception {... |
39 |
1
|
super.tearDown(); |
40 |
|
} |
41 |
|
|
42 |
|
|
43 |
|
@link |
44 |
|
|
45 |
|
@throws |
46 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1
PASS
|
|
47 |
1
|
public final void testGetXPathLocation() throws Exception {... |
48 |
1
|
checkPosition("xpathLocationFinder.xml", |
49 |
|
"/QEDEQ", |
50 |
|
2, 1, 304, 9); |
51 |
1
|
checkPosition("xpathLocationFinder.xml", |
52 |
|
"/QEDEQ[1]", |
53 |
|
2, 1, 304, 9); |
54 |
1
|
checkPosition("xpathLocationFinder.xml", |
55 |
|
"/QEDEQ/CHAPTER/SECTION/NODE", |
56 |
|
100, 7, 139, 14); |
57 |
1
|
checkPosition("xpathLocationFinder.xml", |
58 |
|
"/QEDEQ/CHAPTER[1]/SECTION/NODE[1]", |
59 |
|
100, 7, 139, 14); |
60 |
1
|
checkPosition("xpathLocationFinder.xml", |
61 |
|
"/QEDEQ/CHAPTER/SECTION/NODE@label", |
62 |
|
100, 13, 100, 23); |
63 |
1
|
checkPosition("xpathLocationFinder.xml", |
64 |
|
"/QEDEQ/CHAPTER/SECTION/NODE[2]", |
65 |
|
140, 7, 212, 14); |
66 |
1
|
checkPosition("xpathLocationFinder.xml", |
67 |
|
"/QEDEQ/CHAPTER/SECTION/NODE[2]/AXIOM/FORMULA/FORALL/FORALL/IMPL/FORALL/VAR@id", |
68 |
|
165, 26, 165, 32); |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
@param |
73 |
|
@param |
74 |
|
@param |
75 |
|
@param |
76 |
|
@param |
77 |
|
@param |
78 |
|
@throws |
79 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
80 |
7
|
private void checkPosition(String fileName, String xpath, int startRow, int startCol,... |
81 |
|
int endRow, int endCol) throws Exception { |
82 |
7
|
final File file = getFile(fileName); |
83 |
7
|
final SourceArea result = XPathLocationParser.findSourceArea(file, new SimpleXPath(xpath)); |
84 |
7
|
Trace.param(CLASS, this, "checkPosition", "Start position", result.getStartPosition()); |
85 |
7
|
assertEquals(startRow, result.getStartPosition().getRow()); |
86 |
7
|
assertEquals(startCol, result.getStartPosition().getColumn()); |
87 |
7
|
Trace.param(CLASS, this, "checkPosition", "End position", result.getEndPosition()); |
88 |
7
|
assertEquals(endRow, result.getEndPosition().getRow()); |
89 |
7
|
assertEquals(endCol, result.getEndPosition().getColumn()); |
90 |
|
} |
91 |
|
|
92 |
|
} |