diff options
author | Marc R. Hoffmann <hoffmann@mountainminds.com> | 2018-06-27 21:20:20 +0200 |
---|---|---|
committer | Evgeny Mandrikov <Godin@users.noreply.github.com> | 2018-06-27 21:20:20 +0200 |
commit | 5e1d3090d96c977df9cc330e6f12d505b4f604f4 (patch) | |
tree | 6688357e706d8d6376f1c096ae442cffa333f806 /org.jacoco.report.test/src/org/jacoco | |
parent | 766763d0a128a1cda5fbff83ef6ecddfe7bede8e (diff) | |
download | jacoco-5e1d3090d96c977df9cc330e6f12d505b4f604f4.tar.gz |
Add new attribute "sourcefilename" to "class" element in XML report (#702)
This allows to unambiguously relate classes to source files in case of
multiple top level classes.
Diffstat (limited to 'org.jacoco.report.test/src/org/jacoco')
-rw-r--r-- | org.jacoco.report.test/src/org/jacoco/report/internal/xml/XMLGroupVisitorTest.java | 6 | ||||
-rw-r--r-- | org.jacoco.report.test/src/org/jacoco/report/xml/XMLFormatterTest.java | 10 |
2 files changed, 9 insertions, 7 deletions
diff --git a/org.jacoco.report.test/src/org/jacoco/report/internal/xml/XMLGroupVisitorTest.java b/org.jacoco.report.test/src/org/jacoco/report/internal/xml/XMLGroupVisitorTest.java index fb8771ea..e7eb78e6 100644 --- a/org.jacoco.report.test/src/org/jacoco/report/internal/xml/XMLGroupVisitorTest.java +++ b/org.jacoco.report.test/src/org/jacoco/report/internal/xml/XMLGroupVisitorTest.java @@ -44,7 +44,7 @@ public class XMLGroupVisitorTest { public void setup() throws Exception { buffer = new StringWriter(); support = new XMLSupport(XMLFormatter.class); - root = new XMLDocument("report", "-//JACOCO//DTD Report 1.0//EN", + root = new XMLDocument("report", "-//JACOCO//DTD Report 1.1//EN", "report.dtd", "UTF-8", true, buffer); root.attr("name", "Report"); handler = new XMLGroupVisitor(root, null); @@ -77,8 +77,8 @@ public class XMLGroupVisitorTest { "//report/counter[@type='BRANCH']/@covered")); } - private Document getDocument() throws SAXException, IOException, - ParserConfigurationException { + private Document getDocument() + throws SAXException, IOException, ParserConfigurationException { return support.parse(buffer.toString()); } diff --git a/org.jacoco.report.test/src/org/jacoco/report/xml/XMLFormatterTest.java b/org.jacoco.report.test/src/org/jacoco/report/xml/XMLFormatterTest.java index c79078e1..c409589a 100644 --- a/org.jacoco.report.test/src/org/jacoco/report/xml/XMLFormatterTest.java +++ b/org.jacoco.report.test/src/org/jacoco/report/xml/XMLFormatterTest.java @@ -98,6 +98,8 @@ public class XMLFormatterTest { assertPathMatches("org/jacoco/example", "/report/group/package/@name"); assertPathMatches("org/jacoco/example/FooClass", "/report/group/package/class/@name"); + assertPathMatches("FooClass.java", + "/report/group/package/class/@sourcefilename"); assertPathMatches("fooMethod", "/report/group/package/class/method/@name"); @@ -167,8 +169,8 @@ public class XMLFormatterTest { final IReportVisitor visitor = formatter.createVisitor(output); visitor.visitInfo(infos, data); driver.sendBundle(visitor); - final BufferedReader reader = new BufferedReader(new InputStreamReader( - output.getContentsAsStream(), "UTF-8")); + final BufferedReader reader = new BufferedReader( + new InputStreamReader(output.getContentsAsStream(), "UTF-8")); final String line = reader.readLine(); assertTrue(line, line.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"")); @@ -180,8 +182,8 @@ public class XMLFormatterTest { final IReportVisitor visitor = formatter.createVisitor(output); visitor.visitInfo(infos, data); driver.sendBundle(visitor); - final BufferedReader reader = new BufferedReader(new InputStreamReader( - output.getContentsAsStream(), "UTF-16")); + final BufferedReader reader = new BufferedReader( + new InputStreamReader(output.getContentsAsStream(), "UTF-16")); final String line = reader.readLine(); assertTrue(line, line.startsWith("<?xml version=\"1.0\" encoding=\"UTF-16\"")); |