1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
package io.codeclou.java.junit.xml.merger.model; |
25 |
|
|
26 |
|
import org.w3c.dom.Document; |
27 |
|
import org.w3c.dom.Element; |
28 |
|
|
29 |
|
import javax.xml.parsers.DocumentBuilder; |
30 |
|
import javax.xml.parsers.DocumentBuilderFactory; |
31 |
|
import javax.xml.parsers.ParserConfigurationException; |
32 |
|
import java.util.ArrayList; |
33 |
|
import java.util.List; |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (25) |
Complexity: 7 |
Complexity Density: 0,39 |
|
35 |
|
public class TestSuites { |
36 |
|
|
37 |
|
private String name; |
38 |
|
|
39 |
|
private List<TestSuite> testSuites = new ArrayList<>(); |
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
44 |
4 |
public Long getTests() {... |
45 |
4 |
return testSuites.stream().mapToLong(t -> t.getTests()).sum(); |
46 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
4 |
public Long getFailures() {... |
48 |
4 |
return testSuites.stream().mapToLong(t -> t.getFailures()).sum(); |
49 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
4 |
public Double getTime() {... |
51 |
4 |
return testSuites.stream().mapToDouble(t -> t.getTime()).sum(); |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
5 |
public String getName() {... |
58 |
5 |
return name; |
59 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
60 |
4 |
public void setName(String name) {... |
61 |
4 |
this.name = name; |
62 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
6 |
public List<TestSuite> getTestSuites() {... |
64 |
6 |
return testSuites; |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0,08 |
|
70 |
3 |
public Document toXml() throws ParserConfigurationException {... |
71 |
3 |
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
72 |
3 |
DocumentBuilder builder = factory.newDocumentBuilder(); |
73 |
3 |
Document document = builder.newDocument(); |
74 |
3 |
Element rootEl = document.createElement("testsuites"); |
75 |
3 |
document.appendChild(rootEl); |
76 |
3 |
rootEl.setAttribute("time", this.getTime().toString()); |
77 |
3 |
rootEl.setAttribute("tests", this.getTests().toString()); |
78 |
3 |
rootEl.setAttribute("failures", this.getFailures().toString()); |
79 |
3 |
rootEl.setAttribute("name", this.getName()); |
80 |
3 |
for (TestSuite t : this.testSuites) { |
81 |
5 |
rootEl.appendChild(document.importNode(t.getXml(), true)); |
82 |
|
} |
83 |
3 |
return document; |
84 |
|
} |
85 |
|
|
86 |
|
} |