in maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java [153:201]
public void testSetCompleted(WrappedReportEntry testSetReportEntry, TestSetStats testSetStats) {
Map<String, Map<String, List<WrappedReportEntry>>> classMethodStatistics =
arrangeMethodStatistics(testSetReportEntry, testSetStats);
// The Java Language Spec:
// "Note that the close methods of resources are called in the opposite order of their creation."
try (OutputStream outputStream = getOutputStream(testSetReportEntry);
OutputStreamWriter fw = getWriter(outputStream)) {
XMLWriter ppw = new PrettyPrintXMLWriter(new PrintWriter(fw), XML_INDENT, XML_NL, UTF_8.name(), null);
createTestSuiteElement(ppw, testSetReportEntry, testSetStats); // TestSuite
if (enablePropertiesElement) {
showProperties(ppw, testSetReportEntry.getSystemProperties());
} else {
boolean hasNonSuccess = false;
for (Map<String, List<WrappedReportEntry>> statistics : classMethodStatistics.values()) {
for (List<WrappedReportEntry> thisMethodRuns : statistics.values()) {
if (thisMethodRuns.stream()
.anyMatch(entry -> entry.getReportEntryType() != ReportEntryType.SUCCESS)) {
hasNonSuccess = true;
break;
}
}
if (hasNonSuccess) {
break;
}
}
if (hasNonSuccess) {
showProperties(ppw, testSetReportEntry.getSystemProperties());
}
}
for (Entry<String, Map<String, List<WrappedReportEntry>>> statistics : classMethodStatistics.entrySet()) {
for (Entry<String, List<WrappedReportEntry>> thisMethodRuns :
statistics.getValue().entrySet()) {
serializeTestClass(outputStream, fw, ppw, thisMethodRuns.getValue());
}
}
ppw.endElement(); // TestSuite
} catch (IOException e) {
// It's not a test error.
// This method must be sail-safe and errors are in a dump log.
// The control flow must not be broken in TestSetRunListener#testSetCompleted.
InPluginProcessDumpSingleton.getSingleton().dumpException(e, e.getLocalizedMessage(), reportsDirectory);
}
}