1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.rendering.test.cts; |
21 |
|
|
22 |
|
import java.util.Arrays; |
23 |
|
import java.util.List; |
24 |
|
import java.util.Properties; |
25 |
|
import java.util.Set; |
26 |
|
|
27 |
|
import org.junit.Test; |
28 |
|
|
29 |
|
import org.junit.Assert; |
30 |
|
import static org.junit.Assert.assertThat; |
31 |
|
import static org.hamcrest.Matchers.containsInAnyOrder; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (52) |
Complexity: 2 |
Complexity Density: 0.04 |
|
39 |
|
public class TestDataParserTest |
40 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
41 |
1 |
@Test... |
42 |
|
public void findRelativeTestDirectoryNames() |
43 |
|
{ |
44 |
1 |
TestDataParser parser = new TestDataParser(); |
45 |
1 |
Set<String> prefixes = parser.findRelativeTestDirectoryNames("ctstest", "type", ".*\\.xml"); |
46 |
1 |
Assert.assertEquals(1, prefixes.size()); |
47 |
1 |
Assert.assertEquals("type/test/test1", prefixes.iterator().next()); |
48 |
|
} |
49 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (46) |
Complexity: 1 |
Complexity Density: 0.02 |
1PASS
|
|
50 |
1 |
@Test... |
51 |
|
public void readTestData() throws Exception |
52 |
|
{ |
53 |
1 |
TestDataParser parser = new TestDataParser(); |
54 |
1 |
List<TestData> data = parser.parseTestData("syntax/1.0", "ctstest", "type", ".*\\.xml"); |
55 |
1 |
Assert.assertEquals(4, data.size()); |
56 |
|
|
57 |
1 |
TestDataConfiguration configuration = new TestDataConfiguration(); |
58 |
1 |
Properties properties = new Properties(); |
59 |
1 |
properties.setProperty("type/test/test1", "Description1"); |
60 |
1 |
configuration.testDescriptions = properties; |
61 |
1 |
configuration.failingTests = Arrays.asList("failingregex"); |
62 |
1 |
configuration.notApplicableTests = Arrays.asList("notapplicableregex"); |
63 |
|
|
64 |
1 |
TestData test1 = new TestData(); |
65 |
1 |
test1.isSyntaxInputTest = true; |
66 |
1 |
test1.prefix = "type/test/test1"; |
67 |
1 |
test1.syntaxData = "in"; |
68 |
1 |
test1.syntaxExtension = ".in.txt"; |
69 |
1 |
test1.syntaxId = "syntax/1.0"; |
70 |
1 |
test1.ctsData = "<cts/>"; |
71 |
1 |
test1.ctsExtension = ".inout.xml"; |
72 |
1 |
test1.configuration = configuration; |
73 |
|
|
74 |
1 |
TestData test2 = new TestData(); |
75 |
1 |
test2.isSyntaxInputTest = true; |
76 |
1 |
test2.prefix = "type/test/test1"; |
77 |
1 |
test2.syntaxData = "in1"; |
78 |
1 |
test2.syntaxExtension = ".in.1.txt"; |
79 |
1 |
test2.syntaxId = "syntax/1.0"; |
80 |
1 |
test2.ctsData = "<cts/>"; |
81 |
1 |
test2.ctsExtension = ".inout.xml"; |
82 |
1 |
test2.configuration = configuration; |
83 |
|
|
84 |
1 |
TestData test3 = new TestData(); |
85 |
1 |
test3.isSyntaxInputTest = true; |
86 |
1 |
test3.prefix = "type/test/test1"; |
87 |
1 |
test3.syntaxData = "in2"; |
88 |
1 |
test3.syntaxExtension = ".in.2.txt"; |
89 |
1 |
test3.syntaxId = "syntax/1.0"; |
90 |
1 |
test3.ctsData = "<cts/>"; |
91 |
1 |
test3.ctsExtension = ".inout.xml"; |
92 |
1 |
test3.configuration = configuration; |
93 |
|
|
94 |
1 |
TestData test4 = new TestData(); |
95 |
1 |
test4.isSyntaxInputTest = false; |
96 |
1 |
test4.prefix = test1.prefix; |
97 |
1 |
test4.syntaxData = "out"; |
98 |
1 |
test4.syntaxExtension = ".out.txt"; |
99 |
1 |
test4.syntaxId = test1.syntaxId; |
100 |
1 |
test4.ctsData = test1.ctsData; |
101 |
1 |
test4.ctsExtension = test1.ctsExtension; |
102 |
1 |
test4.configuration = configuration; |
103 |
|
|
104 |
1 |
assertThat(data, containsInAnyOrder(test1, test2, test3, test4)); |
105 |
|
} |
106 |
|
} |