This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch use-renderer
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 28263ca425bd5e862634b291b2ebae56f144487c
Author: Michael Osipov <micha...@apache.org>
AuthorDate: Sun Apr 30 19:01:51 2023 +0200

    first shot
---
 .../report/AbstractSurefireReportMojo.java         |  12 +-
 ...tGenerator.java => SurefireReportRenderer.java} | 112 +++++--------
 .../plugins/surefire/report/Surefire597Test.java   |  57 ++++---
 .../surefire/report/SurefireReportMojoTest.java    | 184 ++++++++++-----------
 .../surefire/report/SurefireReportParser.java      |   9 +-
 5 files changed, 175 insertions(+), 199 deletions(-)

diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
index eaaf294f1..44f107b01 100644
--- 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
@@ -126,9 +126,15 @@ public abstract class AbstractSurefireReportMojo extends 
AbstractMavenReport {
             return;
         }
 
-        new SurefireReportGenerator(
-                        getReportsDirectories(), locale, showSuccess, 
determineXrefLocation(), getConsoleLogger())
-                .doGenerateReport(getBundle(locale), getSink());
+        SurefireReportRenderer r = new SurefireReportRenderer(
+                getSink(),
+                locale,
+                getBundle(locale),
+                getConsoleLogger(),
+                showSuccess,
+                getReportsDirectories(),
+                determineXrefLocation());
+        r.render();
     }
 
     @Override
diff --git 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
similarity index 89%
rename from 
maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
rename to 
maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
index 09667a06a..8d6ffb769 100644
--- 
a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
+++ 
b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportRenderer.java
@@ -29,62 +29,58 @@ import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
 import org.apache.maven.doxia.util.DoxiaUtils;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
-import org.apache.maven.reporting.MavenReportException;
+import org.apache.maven.reporting.AbstractMavenReportRenderer;
 
 import static org.apache.maven.doxia.markup.HtmlMarkup.A;
-import static org.apache.maven.doxia.sink.Sink.JUSTIFY_LEFT;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.CLASS;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.HREF;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.ID;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.STYLE;
-import static org.apache.maven.doxia.sink.SinkEventAttributes.TYPE;
 
 /**
  * This generator creates HTML Report from Surefire and Failsafe XML Report.
  */
-public final class SurefireReportGenerator {
-    private static final int LEFT = JUSTIFY_LEFT;
+public class SurefireReportRenderer extends AbstractMavenReportRenderer {
     private static final Object[] TAG_TYPE_START = {HtmlMarkup.TAG_TYPE_START};
     private static final Object[] TAG_TYPE_END = {HtmlMarkup.TAG_TYPE_END};
 
+    // Not used at the moment
+    private final Locale locale;
+    private final LocalizedProperties bundle;
+
     private final SurefireReportParser report;
     private final boolean showSuccess;
     private final String xrefLocation;
-    private List<ReportTestSuite> testSuites;
+    private final List<ReportTestSuite> testSuites;
 
-    public SurefireReportGenerator(
-            List<File> reportsDirectories,
+    public SurefireReportRenderer(
+            Sink sink,
             Locale locale,
+            LocalizedProperties bundle,
+            ConsoleLogger consoleLogger,
             boolean showSuccess,
-            String xrefLocation,
-            ConsoleLogger consoleLogger) {
+            List<File> reportsDirectories,
+            String xrefLocation) {
+        super(sink);
+        this.locale = locale;
+        this.bundle = bundle;
         report = new SurefireReportParser(reportsDirectories, locale, 
consoleLogger);
+        testSuites = report.parseXMLReportFiles();
         this.showSuccess = showSuccess;
         this.xrefLocation = xrefLocation;
     }
 
-    public void doGenerateReport(LocalizedProperties bundle, Sink sink) throws 
MavenReportException {
-        testSuites = report.parseXMLReportFiles();
-
-        sink.head();
-
-        sink.title();
-        sink.text(bundle.getReportHeader());
-        sink.title_();
-
-        sink.head_();
-
-        sink.body();
-
-        SinkEventAttributeSet atts = new SinkEventAttributeSet();
-        atts.addAttribute(TYPE, "application/javascript");
-        sink.unknown("script", new Object[] {HtmlMarkup.TAG_TYPE_START}, atts);
-        sink.unknown("cdata", new Object[] {HtmlMarkup.CDATA_TYPE, 
javascriptToggleDisplayCode()}, null);
-        sink.unknown("script", new Object[] {HtmlMarkup.TAG_TYPE_END}, null);
+    @Override
+    public String getTitle() {
+        return bundle.getReportHeader();
+    }
 
+    public void renderBody() {
+        sink.rawText(HtmlMarkup.EOL + "<script>" + HtmlMarkup.EOL + 
javascriptToggleDisplayCode() + HtmlMarkup.EOL
+                + "</script>" + HtmlMarkup.EOL);
         sink.section1();
         sink.sectionTitle1();
-        sink.text(bundle.getReportHeader());
+        sink.text(getTitle());
         sink.sectionTitle1_();
         sink.section1_();
 
@@ -103,12 +99,6 @@ public final class SurefireReportGenerator {
         if (!failureList.isEmpty()) {
             constructFailureDetails(sink, bundle, failureList);
         }
-
-        sink.body_();
-
-        sink.flush();
-
-        sink.close();
     }
 
     private void constructSummarySection(LocalizedProperties bundle, Sink 
sink) {
@@ -124,9 +114,7 @@ public final class SurefireReportGenerator {
 
         sinkLineBreak(sink);
 
-        sink.table();
-
-        sink.tableRows(new int[] {LEFT, LEFT, LEFT, LEFT, LEFT, LEFT}, false);
+        startTable();
 
         sink.tableRow();
 
@@ -160,9 +148,7 @@ public final class SurefireReportGenerator {
 
         sink.tableRow_();
 
-        sink.tableRows_();
-
-        sink.table_();
+        endTable();
 
         sink.lineBreak();
 
@@ -189,9 +175,7 @@ public final class SurefireReportGenerator {
 
         sinkLineBreak(sink);
 
-        sink.table();
-
-        sink.tableRows(new int[] {LEFT, LEFT, LEFT, LEFT, LEFT, LEFT, LEFT}, 
false);
+        startTable();
 
         sink.tableRow();
 
@@ -237,10 +221,7 @@ public final class SurefireReportGenerator {
             sink.tableRow_();
         }
 
-        sink.tableRows_();
-
-        sink.table_();
-
+        endTable();
         sink.lineBreak();
 
         sink.paragraph();
@@ -269,9 +250,7 @@ public final class SurefireReportGenerator {
             }
 
             if (showTable) {
-                sink.table();
-
-                sink.tableRows(new int[] {LEFT, LEFT, LEFT, LEFT, LEFT, LEFT, 
LEFT, LEFT}, false);
+                startTable();
 
                 sink.tableRow();
 
@@ -299,9 +278,7 @@ public final class SurefireReportGenerator {
                     }
                 }
 
-                sink.tableRows_();
-
-                sink.table_();
+                endTable();
             }
 
             sink.section2_();
@@ -385,9 +362,7 @@ public final class SurefireReportGenerator {
                 }
 
                 if (showTable) {
-                    sink.table();
-
-                    sink.tableRows(new int[] {LEFT, LEFT, LEFT}, false);
+                    startTable();
 
                     for (ReportTestCase testCase : testCases) {
                         if (!testCase.isSuccessful() || showSuccess) {
@@ -395,9 +370,7 @@ public final class SurefireReportGenerator {
                         }
                     }
 
-                    sink.tableRows_();
-
-                    sink.table_();
+                    endTable();
                 }
 
                 sink.section2_();
@@ -515,9 +488,7 @@ public final class SurefireReportGenerator {
 
         sinkLineBreak(sink);
 
-        sink.table();
-
-        sink.tableRows(new int[] {LEFT, LEFT}, false);
+        startTable();
 
         for (ReportTestCase tCase : failures) {
             sink.tableRow();
@@ -574,9 +545,7 @@ public final class SurefireReportGenerator {
             }
         }
 
-        sink.tableRows_();
-
-        sink.table_();
+        endTable();
 
         sinkLineBreak(sink);
 
@@ -671,11 +640,7 @@ public final class SurefireReportGenerator {
     }
 
     private static String javascriptToggleDisplayCode() {
-
-        // the javascript code is emitted within a commented CDATA section
-        // so we have to start with a newline and comment the CDATA closing in 
the end
-
-        return "\n" + "function toggleDisplay(elementId) {\n"
+        return "function toggleDisplay(elementId) {\n"
                 + " var elm = document.getElementById(elementId + '-error');\n"
                 + " if (elm == null) {\n"
                 + "  elm = document.getElementById(elementId + '-failure');\n"
@@ -689,9 +654,8 @@ public final class SurefireReportGenerator {
                 + "   elm.style.display = \"none\";\n"
                 + "   document.getElementById(elementId + 
'-off').style.display = \"inline\";\n"
                 + "   document.getElementById(elementId + '-on').style.display 
= \"none\";\n"
-                + "  } \n"
-                + " } \n"
+                + "  }\n"
                 + " }\n"
-                + "//";
+                + " }";
     }
 }
diff --git 
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
 
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
index e3274f5b7..1440a015a 100644
--- 
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
+++ 
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
@@ -24,11 +24,11 @@ import java.io.StringWriter;
 import junit.framework.TestCase;
 import org.apache.maven.doxia.module.xhtml5.Xhtml5Sink;
 import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.tools.SiteTool;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 
 import static java.util.Collections.singletonList;
-import static java.util.Locale.ENGLISH;
 import static org.apache.maven.plugins.surefire.report.Utils.toSystemNewLine;
 import static org.hamcrest.CoreMatchers.containsString;
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -41,11 +41,18 @@ public class Surefire597Test extends TestCase {
     public void testCorruptedTestCaseFailureWithMissingErrorTypeAndMessage() 
throws Exception {
         File basedir = new File(".").getCanonicalFile();
         File report = new File(basedir, "target/test-classes/surefire-597");
-        ConsoleLogger log = new NullConsoleLogger();
-        SurefireReportGenerator gen = new 
SurefireReportGenerator(singletonList(report), ENGLISH, true, null, log);
         StringWriter writer = new StringWriter();
         Sink sink = new Xhtml5Sink(writer) {};
-        gen.doGenerateReport(new SurefireReportMojo().getBundle(ENGLISH), 
sink);
+        ConsoleLogger consoleLogger = new NullConsoleLogger();
+        SurefireReportRenderer r = new SurefireReportRenderer(
+                sink,
+                SiteTool.DEFAULT_LOCALE,
+                new SurefireReportMojo().getBundle(SiteTool.DEFAULT_LOCALE),
+                consoleLogger,
+                true,
+                singletonList(report),
+                null);
+        r.render();
         String xml = writer.toString();
         assertThat(
                 xml,
@@ -59,11 +66,11 @@ public class Surefire597Test extends TestCase {
                         + "<th>Time</th></tr>\n"
                         + "<tr class=\"b\">\n"
                         + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td>"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td>"
                         + "</tr>"
                         + "</table>")));
         assertThat(
@@ -79,12 +86,12 @@ public class Surefire597Test extends TestCase {
                         + "<th>Time</th></tr>\n"
                         + "<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire\">surefire</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr></table>")));
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr></table>")));
         assertThat(
                 xml,
                 containsString(toSystemNewLine("<table border=\"0\" 
class=\"bodyTable\">\n"
@@ -99,25 +106,25 @@ public class Surefire597Test extends TestCase {
                         + "<th>Time</th></tr>\n"
                         + "<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire.MyTest\"><img src=\"images/icon_error_sml.gif\" alt=\"\" 
/></a></td>\n"
-                        + "<td align=\"left\"><a 
href=\"#surefire.MyTest\">MyTest</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr></table>")));
+                        + "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr></table>")));
         assertThat(
                 xml,
                 containsString(toSystemNewLine("<table border=\"0\" 
class=\"bodyTable\">\n"
                         + "<tr class=\"a\">\n"
                         + "<td align=\"left\"><img 
src=\"images/icon_error_sml.gif\" alt=\"\" /></td>\n"
-                        + "<td align=\"left\"><a 
id=\"surefire.MyTest.test\"></a>test</td></tr>\n"
+                        + "<td><a 
id=\"surefire.MyTest.test\"></a>test</td></tr>\n"
                         + "<tr class=\"b\">\n"
                         + "<td align=\"left\"></td>\n"
-                        + "<td align=\"left\">java.lang.RuntimeException: 
java.lang.IndexOutOfBoundsException: msg</td></tr>\n"
+                        + "<td>java.lang.RuntimeException: 
java.lang.IndexOutOfBoundsException: msg</td></tr>\n"
                         + "<tr class=\"a\">\n"
                         + "<td align=\"left\"></td>\n"
-                        + "<td align=\"left\">\n"
+                        + "<td>\n"
                         + "<div 
id=\"test-error\">surefire.MyTest:13</div></td></tr></table>")));
     }
 }
diff --git 
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
 
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
index 14c1992da..b5dd1bf42 100644
--- 
a/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
+++ 
b/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/SurefireReportMojoTest.java
@@ -176,10 +176,10 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
         assertTrue(report.exists());
         String htmlContent = FileUtils.fileRead(report);
 
-        int idx = htmlContent.indexOf("<td align=\"left\"><a 
id=\"TC_com.shape.CircleTest.testX\"></a>testX</td>");
+        int idx = htmlContent.indexOf("<td><a 
id=\"TC_com.shape.CircleTest.testX\"></a>testX</td>");
         assertTrue(idx > 0);
 
-        idx = htmlContent.indexOf("<td align=\"left\"><a 
id=\"TC_com.shape.CircleTest.testRadius\"></a>"
+        idx = htmlContent.indexOf("<td><a 
id=\"TC_com.shape.CircleTest.testRadius\"></a>"
                 + "<a 
href=\"#com.shape.CircleTest.testRadius\">testRadius</a>");
         assertTrue(idx > 0);
     }
@@ -197,22 +197,22 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td>")));
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td>")));
 
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire\">surefire</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
@@ -221,13 +221,13 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                         + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />"
                         + "</a>"
                         + "</td>\n"
-                        + "<td align=\"left\"><a 
href=\"#surefire.MyTest\">MyTest</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
 
         assertThat(htmlContent, containsString(">surefire.MyTest:13</a>"));
 
@@ -286,22 +286,22 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td>")));
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td>")));
 
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire\">surefire</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
@@ -310,13 +310,13 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                         + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />"
                         + "</a>"
                         + "</td>\n"
-                        + "<td align=\"left\"><a 
href=\"#surefire.MyTest\">MyTest</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(htmlContent, containsString(">surefire.MyTest:13</a>"));
 
         assertThat(htmlContent, 
containsString("./xref-test/surefire/MyTest.html#L13"));
@@ -350,22 +350,22 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td>")));
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td>")));
 
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire\">surefire</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
@@ -374,13 +374,13 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                         + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />"
                         + "</a>"
                         + "</td>\n"
-                        + "<td align=\"left\"><a 
href=\"#surefire.MyTest\">MyTest</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td><a href=\"#surefire.MyTest\">MyTest</a></td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(htmlContent, containsString(">surefire.MyTest:13</a>"));
 
         assertThat(htmlContent, 
containsString("./xref-test/surefire/MyTest.html#L13"));
@@ -439,22 +439,22 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td>")));
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td>")));
 
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire\">surefire</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
@@ -463,13 +463,13 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                         + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />"
                         + "</a>"
                         + "</td>\n"
-                        + "<td align=\"left\"><a 
href=\"#surefire.MyTest$A\">MyTest$A</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td><a 
href=\"#surefire.MyTest$A\">MyTest$A</a></td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
 
         assertThat(htmlContent, containsString(">surefire.MyTest$A:45</a>"));
 
@@ -503,22 +503,22 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td>")));
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td>")));
 
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
                         + "<td align=\"left\"><a 
href=\"#surefire\">surefire</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
         assertThat(
                 htmlContent,
                 containsString(toSystemNewLine("<tr class=\"b\">\n"
@@ -527,13 +527,13 @@ public class SurefireReportMojoTest extends 
AbstractMojoTestCase {
                         + "<img src=\"images/icon_error_sml.gif\" alt=\"\" />"
                         + "</a>"
                         + "</td>\n"
-                        + "<td align=\"left\"><a 
href=\"#surefire.MyTest$A\">MyTest$A</a></td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">1</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0</td>\n"
-                        + "<td align=\"left\">0%</td>\n"
-                        + "<td align=\"left\">0</td></tr>")));
+                        + "<td><a 
href=\"#surefire.MyTest$A\">MyTest$A</a></td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>1</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0</td>\n"
+                        + "<td>0%</td>\n"
+                        + "<td>0</td></tr>")));
 
         assertThat(htmlContent, containsString(">surefire.MyTest$A:45</a>"));
 
diff --git 
a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
 
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
index 467d78487..ed2b0f582 100644
--- 
a/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
+++ 
b/surefire-report-parser/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportParser.java
@@ -31,7 +31,6 @@ import java.util.Locale;
 import java.util.Map;
 
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
-import org.apache.maven.reporting.MavenReportException;
 import org.apache.maven.shared.utils.io.DirectoryScanner;
 import org.xml.sax.SAXException;
 
@@ -62,7 +61,7 @@ public final class SurefireReportParser {
         this.consoleLogger = consoleLogger;
     }
 
-    public List<ReportTestSuite> parseXMLReportFiles() throws 
MavenReportException {
+    public List<ReportTestSuite> parseXMLReportFiles() {
         final Collection<File> xmlReportFiles = new ArrayList<>();
         for (File reportsDirectory : reportsDirectories) {
             if (reportsDirectory.exists()) {
@@ -76,11 +75,11 @@ public final class SurefireReportParser {
             try {
                 
testSuites.addAll(parser.parse(aXmlReportFileList.getAbsolutePath()));
             } catch (ParserConfigurationException e) {
-                throw new MavenReportException("Error setting up parser for 
JUnit XML report", e);
+                throw new RuntimeException("Error setting up parser for JUnit 
XML report", e);
             } catch (SAXException e) {
-                throw new MavenReportException("Error parsing JUnit XML report 
" + aXmlReportFileList, e);
+                throw new RuntimeException("Error parsing JUnit XML report " + 
aXmlReportFileList, e);
             } catch (IOException e) {
-                throw new MavenReportException("Error reading JUnit XML report 
" + aXmlReportFileList, e);
+                throw new RuntimeException("Error reading JUnit XML report " + 
aXmlReportFileList, e);
             }
         }
 

Reply via email to