This is an automated email from the ASF dual-hosted git repository.
jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git
The following commit(s) were added to refs/heads/master by this push:
new dee3715 bz-64952 junitlauncher - properly report JUnit4 Parametrized
test, in the XML report
dee3715 is described below
commit dee3715270a8da31095727e8f9f083bc6585e1a4
Author: Gösen <[email protected]>
AuthorDate: Tue Apr 14 12:47:28 2020 +0200
bz-64952 junitlauncher - properly report JUnit4 Parametrized test, in the
XML report
Closes #125 pull request at github/apache/ant repo
---
CONTRIBUTORS | 1 +
WHATSNEW | 4 ++++
contributors.xml | 4 ++++
.../taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java | 7 ++++++-
4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 9d06fb7..69fc46b 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -158,6 +158,7 @@ Gilles Querret
Gilles Scokart
Glenn McAllister
Glenn Twiggs
+Gösen
Greg Nelson
Greg Roodt
Greg Schueler
diff --git a/WHATSNEW b/WHATSNEW
index bf2406a..9473c71 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -19,6 +19,10 @@ Fixed bugs:
and system-out
Bugzilla Report 63436
+ * Fixes a bug in junitlauncher task's legacy-xml formatter, where the testcase
+ representing a @Parameterized JUnit4 test wasn't being reported in the XML.
+ Bugzilla Report 64952
+
Other changes:
--------------
diff --git a/contributors.xml b/contributors.xml
index a2969b5..bd46c45 100644
--- a/contributors.xml
+++ b/contributors.xml
@@ -665,6 +665,10 @@
<last>Twiggs</last>
</name>
<name>
+ <first>Gösen</first>
+ <last></last>
+ </name>
+ <name>
<first>Greg</first>
<last>Nelson</last>
</name>
diff --git
a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java
b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java
index 35df278..d86c35b 100644
---
a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java
+++
b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyXmlResultFormatter.java
@@ -407,9 +407,14 @@ class LegacyXmlResultFormatter extends
AbstractJUnitResultFormatter implements T
private Optional<ClassSource> findFirstParentClassSource(final
TestIdentifier testId) {
final Optional<TestIdentifier> parent = testPlan.getParent(testId);
- if (!parent.isPresent() || !parent.get().getSource().isPresent()) {
+ if (!parent.isPresent()) {
return Optional.empty();
}
+ if (!parent.get().getSource().isPresent()) {
+ // the source of the parent is unknown, so we move up the
+ // hierarchy and try and find a class source
+ return findFirstParentClassSource(parent.get());
+ }
final TestSource parentSource = parent.get().getSource().get();
return parentSource instanceof ClassSource ?
Optional.of((ClassSource) parentSource)
: findFirstParentClassSource(parent.get());