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