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