You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2018/03/17 16:31:43 UTC

[1/2] maven-surefire git commit: [SUREFIRE-1495] Encoding of TXT report file should be configured by ${project.reporting.outputEncoding} and MOJO parameter encoding [Forced Update!]

Repository: maven-surefire
Updated Branches:
  refs/heads/SUREFIRE-1490 6174be76f -> be4e4c0c7 (forced update)


[SUREFIRE-1495] Encoding of TXT report file should be configured by ${project.reporting.outputEncoding} and MOJO parameter encoding


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/bcd27b7f
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/bcd27b7f
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/bcd27b7f

Branch: refs/heads/SUREFIRE-1490
Commit: bcd27b7f2b560fe6fa0b2927913c3c4a15e5c41e
Parents: c10e717
Author: Tibor17 <ti...@apache.org>
Authored: Thu Mar 8 08:19:02 2018 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Sat Mar 17 11:19:54 2018 +0100

----------------------------------------------------------------------
 .gitattributes                                  |  6 ++-
 Jenkinsfile                                     |  4 +-
 .../plugin/failsafe/IntegrationTestMojo.java    | 19 +++++++--
 .../plugin/surefire/AbstractSurefireMojo.java   |  3 +-
 .../maven/plugin/surefire/CommonReflector.java  |  5 ++-
 .../surefire/StartupReportConfiguration.java    | 41 +++++++-------------
 .../surefire/SurefireExecutionParameters.java   |  4 ++
 .../surefire/report/DefaultReporterFactory.java | 11 ------
 .../plugin/surefire/report/FileReporter.java    | 14 +++++--
 .../surefire/report/NullFileReporter.java       |  2 +-
 .../AbstractSurefireMojoJava7PlusTest.java      | 12 ++++++
 .../surefire/AbstractSurefireMojoTest.java      | 12 ++++++
 .../TestSetMockReporterFactory.java             | 17 +++++++-
 .../report/DefaultReporterFactoryTest.java      |  2 +-
 .../report/ConsoleOutputFileReporterTest.java   | 34 +++++++++++-----
 .../maven/surefire/report/FileReporterTest.java |  8 ++--
 .../maven/plugin/surefire/SurefirePlugin.java   | 22 +++++++++++
 .../maven/surefire/its/UnicodeTestNamesIT.java  | 14 +++++--
 .../surefire/its/fixture/HelperAssertions.java  |  6 +++
 .../surefire/its/fixture/OutputValidator.java   |  9 ++++-
 .../maven/surefire/its/fixture/TestFile.java    |  2 +-
 .../jiras/Surefire141PluggableProvidersIT.java  | 16 +-------
 .../jiras/Surefire975DefaultVMEncodingIT.java   |  5 ++-
 .../test/resources/unicode-testnames/pom.xml    |  1 +
 .../junitcore/ConcurrentRunListenerTest.java    |  2 +-
 .../surefire/junitcore/JUnitCoreTester.java     | 27 ++++++++++++-
 .../surefire/junitcore/Surefire746Test.java     |  3 +-
 27 files changed, 206 insertions(+), 95 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
index 3bb3b5e..4f942c9 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,8 +1,12 @@
 # Auto detect text files and perform LF normalization
-*        text=auto
+* text eol=lf
 
+*.xml    text diff=xml
 *.java   text diff=java
 *.html   text diff=html
+*.vm     text
+*.fml    text
+*.md     text
 *.css    text
 *.js     text
 *.sql    text

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/Jenkinsfile
----------------------------------------------------------------------
diff --git a/Jenkinsfile b/Jenkinsfile
index 5733847..c33159c 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -27,8 +27,8 @@ properties(
 )
 
 final def oses = ['linux', 'windows']
-final def mavens = ['3.2.x', '3.3.x', '3.5.x']//env.BRANCH_NAME == 'master' ? ['3.2.x', '3.3.x', '3.5.x'] : ['3.5.x']
-final def jdks = [7, 8, 9, 10]//env.BRANCH_NAME == 'master' ? [7, 8, 9, 10] : [9, 10]
+final def mavens = ['3.2.x', '3.3.x', '3.5.x'] // env.BRANCH_NAME == 'master' ? ['3.2.x', '3.3.x', '3.5.x'] : ['3.2.x', '3.5.x']
+final def jdks = [7, 8, 9, 10] // env.BRANCH_NAME == 'master' ? [7, 8, 9, 10] : [7, 10]
 
 final def options = ['-e', '-V', '-B', '-nsu', '-P', 'run-its']
 final def goals = ['clean', 'install', 'jacoco:report']

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
----------------------------------------------------------------------
diff --git a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
index 3474b16..51414cf 100644
--- a/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
+++ b/maven-failsafe-plugin/src/main/java/org/apache/maven/plugin/failsafe/IntegrationTestMojo.java
@@ -256,10 +256,11 @@ public class IntegrationTestMojo
     private boolean useManifestOnlyJar;
 
     /**
-     * The character encoding scheme to be applied.
-     * Deprecated since 2.20.1 and used encoding UTF-8 in <tt>failsafe-summary.xml</tt>.
+     * The character encoding scheme to be applied while generating test report
+     * files (see target/surefire-reports/yourTestName.txt).
+     * The report output files (*-out.txt) are still encoded with JVM's encoding used in standard out/err pipes.
      *
-     * @deprecated since of 2.20.1
+     * @since 3.0.0-M1
      */
     @Parameter( property = "encoding", defaultValue = "${project.reporting.outputEncoding}" )
     private String encoding;
@@ -703,6 +704,18 @@ public class IntegrationTestMojo
         this.useManifestOnlyJar = useManifestOnlyJar;
     }
 
+    @Override
+    public String getEncoding()
+    {
+        return encoding;
+    }
+
+    @Override
+    public void setEncoding( String encoding )
+    {
+        this.encoding = encoding;
+    }
+
     // the following will be refactored out once the common code is all in one place
 
     public boolean isTestFailureIgnore()

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 38d18db..34f805a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1807,7 +1807,7 @@ public abstract class AbstractSurefireMojo
                                                isRedirectTestOutputToFile(), isDisableXmlReport(),
                                                getReportsDirectory(), isTrimStackTrace(), getReportNameSuffix(),
                                                getStatisticsFile( configChecksum ), requiresRunHistory(),
-                                               getRerunFailingTestsCount(), getReportSchemaLocation() );
+                                               getRerunFailingTestsCount(), getReportSchemaLocation(), getEncoding() );
     }
 
     private boolean isSpecificTestSpecified()
@@ -2337,6 +2337,7 @@ public abstract class AbstractSurefireMojo
         checksum.add( isDisableXmlReport() );
         checksum.add( isUseSystemClassLoader() );
         checksum.add( isUseManifestOnlyJar() );
+        checksum.add( getEncoding() );
         checksum.add( isEnableAssertions() );
         checksum.add( getObjectFactory() );
         checksum.add( getFailIfNoTests() );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
index 1918930..c0246d3 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
@@ -72,14 +72,15 @@ public class CommonReflector
         Constructor<?> constructor = getConstructor( startupReportConfiguration, boolean.class, boolean.class,
                                                            String.class, boolean.class, boolean.class, File.class,
                                                            boolean.class, String.class, File.class, boolean.class,
-                                                           int.class, String.class );
+                                                           int.class, String.class, String.class );
         //noinspection BooleanConstructorCall
         Object[] params = { reporterConfiguration.isUseFile(), reporterConfiguration.isPrintSummary(),
             reporterConfiguration.getReportFormat(), reporterConfiguration.isRedirectTestOutputToFile(),
             reporterConfiguration.isDisableXmlReport(), reporterConfiguration.getReportsDirectory(),
             reporterConfiguration.isTrimStackTrace(), reporterConfiguration.getReportNameSuffix(),
             reporterConfiguration.getStatisticsFile(), reporterConfiguration.isRequiresRunHistory(),
-            reporterConfiguration.getRerunFailingTestsCount(), reporterConfiguration.getXsdSchemaLocation() };
+            reporterConfiguration.getRerunFailingTestsCount(), reporterConfiguration.getXsdSchemaLocation(),
+            reporterConfiguration.getEncoding().name() };
         return newInstance( constructor, params );
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
index 28e7ff0..caf0db3 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
@@ -30,12 +30,14 @@ import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import javax.annotation.Nonnull;
 import java.io.File;
 import java.io.PrintStream;
+import java.nio.charset.Charset;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import static org.apache.maven.plugin.surefire.report.ConsoleReporter.BRIEF;
 import static org.apache.maven.plugin.surefire.report.ConsoleReporter.PLAIN;
+import static org.apache.commons.lang3.StringUtils.trimToNull;
 
 /**
  * All the parameters used to construct reporters
@@ -80,6 +82,8 @@ public final class StartupReportConfiguration
     private final Map<String, Map<String, List<WrappedReportEntry>>> testClassMethodRunHistory
         = new ConcurrentHashMap<String, Map<String, List<WrappedReportEntry>>>();
 
+    private final Charset encoding;
+
     private StatisticsReporter statisticsReporter;
 
     @SuppressWarnings( "checkstyle:parameternumber" )
@@ -87,7 +91,7 @@ public final class StartupReportConfiguration
                                        boolean redirectTestOutputToFile, boolean disableXmlReport,
                                        @Nonnull File reportsDirectory, boolean trimStackTrace, String reportNameSuffix,
                                        File statisticsFile, boolean requiresRunHistory,
-                                       int rerunFailingTestsCount, String xsdSchemaLocation )
+                                       int rerunFailingTestsCount, String xsdSchemaLocation, String encoding )
     {
         this.useFile = useFile;
         this.printSummary = printSummary;
@@ -103,32 +107,8 @@ public final class StartupReportConfiguration
         this.originalSystemErr = System.err;
         this.rerunFailingTestsCount = rerunFailingTestsCount;
         this.xsdSchemaLocation = xsdSchemaLocation;
-    }
-
-    /**
-     * For testing purposes only.
-     *
-     * @return StartupReportConfiguration fo testing purposes
-     */
-    public static StartupReportConfiguration defaultValue()
-    {
-        File target = new File( "./target" );
-        File statisticsFile = new File( target, "TESTHASH" );
-        return new StartupReportConfiguration( true, true, "PLAIN", false, false, target, false, null, statisticsFile,
-                                               false, 0, null );
-    }
-
-    /**
-     * For testing purposes only.
-     *
-     * @return StartupReportConfiguration fo testing purposes
-     */
-    public static StartupReportConfiguration defaultNoXml()
-    {
-        File target = new File( "./target" );
-        File statisticsFile = new File( target, "TESTHASHxXML" );
-        return new StartupReportConfiguration( true, true, "PLAIN", false, true, target, false, null, statisticsFile,
-                                               false, 0, null );
+        String charset = trimToNull( encoding );
+        this.encoding = charset == null ? Charset.defaultCharset() : Charset.forName( charset );
     }
 
     public boolean isUseFile()
@@ -182,7 +162,7 @@ public final class StartupReportConfiguration
     public FileReporter instantiateFileReporter()
     {
         return isUseFile() && isBriefOrPlainFormat()
-            ? new FileReporter( reportsDirectory, getReportNameSuffix() )
+            ? new FileReporter( reportsDirectory, getReportNameSuffix(), encoding )
             : null;
     }
 
@@ -232,4 +212,9 @@ public final class StartupReportConfiguration
     {
         return xsdSchemaLocation;
     }
+
+    public Charset getEncoding()
+    {
+        return encoding;
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
index 240427f..4425ddc 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireExecutionParameters.java
@@ -118,6 +118,10 @@ public interface SurefireExecutionParameters
 
     void setUseManifestOnlyJar( boolean useManifestOnlyJar );
 
+    String getEncoding();
+
+    void setEncoding( String encoding );
+
     Boolean getFailIfNoSpecifiedTests();
 
     void setFailIfNoSpecifiedTests( boolean failIfNoSpecifiedTests );

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
index bbc9591..8812156 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactory.java
@@ -22,7 +22,6 @@ package org.apache.maven.plugin.surefire.report;
 import org.apache.maven.plugin.surefire.StartupReportConfiguration;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.plugin.surefire.log.api.Level;
-import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 import org.apache.maven.shared.utils.logging.MessageBuilder;
 import org.apache.maven.surefire.report.ReporterFactory;
@@ -208,16 +207,6 @@ public class DefaultReporterFactory
     }
 
     /**
-     * For testing purposes only.
-     *
-     * @return DefaultReporterFactory for testing purposes
-     */
-    public static DefaultReporterFactory defaultNoXml()
-    {
-        return new DefaultReporterFactory( StartupReportConfiguration.defaultNoXml(), new NullConsoleLogger() );
-    }
-
-    /**
      * Get the result of a test based on all its runs. If it has success and failures/errors, then it is a flake;
      * if it only has errors or failures, then count its result based on its first run
      *

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
index 15b902d..8a34c0b 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/FileReporter.java
@@ -24,9 +24,12 @@ import org.apache.maven.surefire.report.ReporterException;
 
 import java.io.BufferedWriter;
 import java.io.File;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
 import java.util.List;
 
 import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
@@ -41,13 +44,14 @@ import static org.apache.maven.surefire.util.internal.StringUtils.isNotBlank;
 public class FileReporter
 {
     private final File reportsDirectory;
-
     private final String reportNameSuffix;
+    private final Charset encoding;
 
-    public FileReporter( File reportsDirectory, String reportNameSuffix )
+    public FileReporter( File reportsDirectory, String reportNameSuffix, Charset encoding )
     {
         this.reportsDirectory = reportsDirectory;
         this.reportNameSuffix = reportNameSuffix;
+        this.encoding = encoding;
     }
 
     private PrintWriter testSetStarting( ReportEntry report )
@@ -61,7 +65,9 @@ public class FileReporter
 
         try
         {
-            PrintWriter writer = new PrintWriter( new BufferedWriter( new FileWriter( reportFile ), 16 * 1024 ) );
+            Writer encodedStream = new OutputStreamWriter( new FileOutputStream( reportFile ), encoding );
+
+            PrintWriter writer = new PrintWriter( new BufferedWriter( encodedStream, 16 * 1024 ) );
 
             writer.println( "-------------------------------------------------------------------------------" );
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
index bca3c4c..df1bf9d 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullFileReporter.java
@@ -35,7 +35,7 @@ class NullFileReporter
 
     private NullFileReporter()
     {
-        super( null, null );
+        super( null, null, null );
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
index e34d7d1..8310fe3 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoJava7PlusTest.java
@@ -473,6 +473,18 @@ public class AbstractSurefireMojoJava7PlusTest
         }
 
         @Override
+        public String getEncoding()
+        {
+            return null;
+        }
+
+        @Override
+        public void setEncoding( String encoding )
+        {
+
+        }
+
+        @Override
         public Boolean getFailIfNoSpecifiedTests()
         {
             return null;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
index a5ef345..481d91e 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/AbstractSurefireMojoTest.java
@@ -494,6 +494,18 @@ public class AbstractSurefireMojoTest
         }
 
         @Override
+        public String getEncoding()
+        {
+            return null;
+        }
+
+        @Override
+        public void setEncoding( String encoding )
+        {
+
+        }
+
+        @Override
         public Boolean getFailIfNoSpecifiedTests()
         {
             return null;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
index 5e4f682..b0acaa3 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
@@ -19,11 +19,12 @@ package org.apache.maven.plugin.surefire.booterclient;
  * under the License.
  */
 
+import org.apache.maven.plugin.surefire.StartupReportConfiguration;
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.surefire.report.RunListener;
 
-import static org.apache.maven.plugin.surefire.StartupReportConfiguration.defaultValue;
+import java.io.File;
 
 /**
  * Internal tests use only.
@@ -43,4 +44,18 @@ public class TestSetMockReporterFactory
     {
         return new MockReporter();
     }
+
+
+    /**
+     * For testing purposes only.
+     *
+     * @return StartupReportConfiguration fo testing purposes
+     */
+    private static StartupReportConfiguration defaultValue()
+    {
+        File target = new File( "./target" );
+        File statisticsFile = new File( target, "TESTHASH" );
+        return new StartupReportConfiguration( true, true, "PLAIN", false, false, target, false, null, statisticsFile,
+                false, 0, null, null );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
index 659040d..87d6800 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
@@ -66,7 +66,7 @@ public class DefaultReporterFactoryTest
         File reportsDirectory = new File("target");
         StartupReportConfiguration reportConfig =
                 new StartupReportConfiguration( true, true, "PLAIN", false, false, reportsDirectory, false, null,
-                                                      new File( reportsDirectory, "TESTHASH" ), false, 1, null );
+                                                      new File( reportsDirectory, "TESTHASH" ), false, 1, null, null );
 
         DummyTestReporter reporter = new DummyTestReporter();
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
index 6943b70..f5f3fd5 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/ConsoleOutputFileReporterTest.java
@@ -20,9 +20,15 @@ package org.apache.maven.surefire.report;
  */
 
 import java.io.File;
+import java.io.IOException;
+
 import org.apache.maven.plugin.surefire.report.ConsoleOutputFileReporter;
 
 import junit.framework.TestCase;
+import org.apache.maven.shared.utils.io.FileUtils;
+
+import static org.apache.maven.surefire.util.internal.StringUtils.US_ASCII;
+import static org.fest.assertions.Assertions.assertThat;
 
 public class ConsoleOutputFileReporterTest
     extends TestCase
@@ -32,42 +38,52 @@ public class ConsoleOutputFileReporterTest
 
     private ReportEntry reportEntry;
 
-    private static final String testName = "org.apache.maven.surefire.report.ConsoleOutputFileReporterTest";
+    private static final String testName = ConsoleOutputFileReporterTest.class.getName();
 
     /*
      * Test method for 'org.codehaus.surefire.report.ConsoleOutputFileReporter.testSetCompleted(ReportEntry report)'
      */
-    public void testFileNameWithoutSuffix()
+    public void testFileNameWithoutSuffix() throws IOException
     {
-        File reportDir = new File( System.getProperty( "java.io.tmpdir" ) );
-        reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
+        File reportDir = new File( new File( System.getProperty( "user.dir" ), "target" ), "tmp" );
+        //noinspection ResultOfMethodCallIgnored
+        reportDir.mkdirs();
+        reportEntry = new SimpleReportEntry( getClass().getName(), testName );
         reporter = new ConsoleOutputFileReporter( reportDir, null );
         reporter.testSetStarting( reportEntry );
-        reporter.writeTestOutput( "some text".getBytes(), 0, 5, true );
+        reporter.writeTestOutput( "some text".getBytes( US_ASCII ), 0, 5, true );
         reporter.testSetCompleted( reportEntry );
+        reporter.close();
 
         File expectedReportFile = new File( reportDir, testName + "-output.txt" );
         assertTrue( "Report file (" + expectedReportFile.getAbsolutePath() + ") doesn't exist",
                     expectedReportFile.exists() );
+        assertThat( FileUtils.fileRead( expectedReportFile, US_ASCII.name() ) ).contains( "some " );
+        //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
     }
 
     /*
      * Test method for 'org.codehaus.surefire.report.ConsoleOutputFileReporter.testSetCompleted(ReportEntry report)'
      */
-    public void testFileNameWithSuffix()
+    public void testFileNameWithSuffix() throws IOException
     {
-        File reportDir = new File( System.getProperty( "java.io.tmpdir" ) );
+        File reportDir = new File( new File( System.getProperty( "user.dir" ), "target" ), "tmp" );
+        //noinspection ResultOfMethodCallIgnored
+        reportDir.mkdirs();
         String suffixText = "sampleSuffixText";
-        reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
+        reportEntry = new SimpleReportEntry( getClass().getName(), testName );
         reporter = new ConsoleOutputFileReporter( reportDir, suffixText );
         reporter.testSetStarting( reportEntry );
-        reporter.writeTestOutput( "some text".getBytes(), 0, 5, true );
+        reporter.writeTestOutput( "some text".getBytes( US_ASCII ), 0, 5, true );
         reporter.testSetCompleted( reportEntry );
+        reporter.close();
 
         File expectedReportFile = new File( reportDir, testName + "-" + suffixText + "-output.txt" );
         assertTrue( "Report file (" + expectedReportFile.getAbsolutePath() + ") doesn't exist",
                     expectedReportFile.exists() );
+        assertThat( FileUtils.fileRead( expectedReportFile, US_ASCII.name() ) ).contains( "some " );
+        //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
index 7c49547..b733e2a 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/surefire/report/FileReporterTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.surefire.report;
  */
 
 import java.io.File;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import org.apache.maven.plugin.surefire.report.FileReporter;
 import org.apache.maven.plugin.surefire.report.ReportEntryType;
@@ -44,12 +45,13 @@ public class FileReporterTest
         reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
         WrappedReportEntry wrappedReportEntry =
             new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null );
-        reporter = new FileReporter( reportDir, null );
+        reporter = new FileReporter( reportDir, null, Charset.defaultCharset() );
         reporter.testSetCompleted( wrappedReportEntry, createTestSetStats(), new ArrayList<String>() );
 
         File expectedReportFile = new File( reportDir, testName + ".txt" );
         assertTrue( "Report file (" + expectedReportFile.getAbsolutePath() + ") doesn't exist",
                     expectedReportFile.exists() );
+        //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
     }
 
@@ -65,13 +67,13 @@ public class FileReporterTest
         reportEntry = new SimpleReportEntry( this.getClass().getName(), testName );
         WrappedReportEntry wrappedReportEntry =
             new WrappedReportEntry( reportEntry, ReportEntryType.SUCCESS, 12, null, null );
-        reporter = new FileReporter( reportDir, suffixText );
+        reporter = new FileReporter( reportDir, suffixText, Charset.defaultCharset() );
         reporter.testSetCompleted( wrappedReportEntry, createTestSetStats(), new ArrayList<String>() );
 
         File expectedReportFile = new File( reportDir, testName + "-" + suffixText + ".txt" );
         assertTrue( "Report file (" + expectedReportFile.getAbsolutePath() + ") doesn't exist",
                     expectedReportFile.exists() );
+        //noinspection ResultOfMethodCallIgnored
         expectedReportFile.delete();
     }
-
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
----------------------------------------------------------------------
diff --git a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
index 6873ad0..09a5661 100644
--- a/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
+++ b/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
@@ -237,6 +237,16 @@ public class SurefirePlugin
     private boolean useManifestOnlyJar;
 
     /**
+     * The character encoding scheme to be applied while generating test report
+     * files (see target/surefire-reports/yourTestName.txt).
+     * The report output files (*-out.txt) are still encoded with JVM's encoding used in standard out/err pipes.
+     *
+     * @since 3.0.0-M1
+     */
+    @Parameter( property = "surefire.encoding", defaultValue = "${project.reporting.outputEncoding}" )
+    private String encoding;
+
+    /**
      * (JUnit 4+ providers)
      * The number of times each failing test will be rerun. If set larger than 0, rerun failing tests immediately after
      * they fail. If a failing test passes in any of those reruns, it will be marked as pass and reported as a "flake".
@@ -514,6 +524,18 @@ public class SurefirePlugin
     }
 
     @Override
+    public String getEncoding()
+    {
+        return encoding;
+    }
+
+    @Override
+    public void setEncoding( String encoding )
+    {
+        this.encoding = encoding;
+    }
+
+    @Override
     public Boolean getFailIfNoSpecifiedTests()
     {
         return failIfNoSpecifiedTests;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
index 64db960..3ce7336 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/UnicodeTestNamesIT.java
@@ -27,6 +27,8 @@ import org.junit.Test;
 
 import java.io.File;
 
+import static org.apache.commons.io.Charsets.UTF_8;
+import static org.apache.maven.surefire.its.fixture.HelperAssertions.convertUnicodeToUTF8;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeFalse;
@@ -37,6 +39,7 @@ import static org.junit.Assume.assumeFalse;
 public class UnicodeTestNamesIT
         extends SurefireJUnit4IntegrationTestCase
 {
+    private static final String REPORT_FILE_CONTENT = "junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test";
     private static final String TXT_REPORT = "junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test.txt";
     private static final String XML_REPORT = "TEST-junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test.xml";
 
@@ -62,14 +65,17 @@ public class UnicodeTestNamesIT
                 unpacked.executeTest()
                         .assertTestSuiteResults( 2, 0, 0, 0 );
 
-        TestFile surefireReportFile = outputValidator.getSurefireReportsFile( TXT_REPORT );
+        TestFile surefireReportFile = outputValidator.getSurefireReportsFile( TXT_REPORT, UTF_8 );
         assertTrue( surefireReportFile.exists() );
-        surefireReportFile.assertContainsText( "junit.twoTestCases.????Test" );
+
+        // See src/test/resources/unicode-testnames/pom.xml and property project.build.sourceEncoding set to UTF-8.
+        surefireReportFile.assertContainsText( convertUnicodeToUTF8( REPORT_FILE_CONTENT ) );
 
         TestFile surefireXmlReportFile = outputValidator.getSurefireReportsXmlFile( XML_REPORT );
         assertTrue( surefireXmlReportFile.exists() );
         assertFalse( surefireXmlReportFile.readFileToString().isEmpty() );
-        surefireXmlReportFile.assertContainsText( "junit.twoTestCases.\u800C\u7D22\u5176\u60C5Test" );
-    }
 
+        // See src/test/resources/unicode-testnames/pom.xml and property project.build.sourceEncoding set to UTF-8.
+        surefireXmlReportFile.assertContainsText( convertUnicodeToUTF8( REPORT_FILE_CONTENT ) );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
index ed0d40c..d6b03bd 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/HelperAssertions.java
@@ -30,6 +30,7 @@ import java.util.Locale;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertTrue;
+import static org.apache.commons.io.Charsets.UTF_8;
 import static org.junit.Assume.assumeTrue;
 
 @SuppressWarnings( { "JavaDoc" } )
@@ -171,4 +172,9 @@ public class HelperAssertions
         assumeTrue( "java.specification.version: " + thisVersion,
                 Double.valueOf( thisVersion ) >= expectedVersion );
     }
+
+    public static String convertUnicodeToUTF8( String unicode )
+    {
+        return new String( unicode.getBytes( UTF_8 ), UTF_8 );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java
index a76f86f..1c53e55 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/OutputValidator.java
@@ -182,10 +182,15 @@ public class OutputValidator
         return new TestFile( new File( targetDir, fileName ), this );
     }
 
-    public TestFile getSurefireReportsFile( String fileName )
+    public TestFile getSurefireReportsFile( String fileName, Charset charset )
     {
         File targetDir = getSurefireReportsDirectory();
-        return new TestFile( new File( targetDir, fileName ), this );
+        return new TestFile( new File( targetDir, fileName ), charset, this );
+    }
+
+    public TestFile getSurefireReportsFile( String fileName )
+    {
+        return getSurefireReportsFile( fileName, null );
     }
 
     public TestFile getSurefireReportsXmlFile( String fileName )

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
index cf6ad84..f68eb35 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/fixture/TestFile.java
@@ -53,7 +53,7 @@ public class TestFile
     public TestFile( File file, Charset charset, OutputValidator surefireVerifier )
     {
         this.file = file;
-        this.encoding = charset;
+        this.encoding = charset == null ? Charset.defaultCharset() : charset;
         this.surefireVerifier = surefireVerifier;
     }
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java
index b185217..0856482 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire141PluggableProvidersIT.java
@@ -155,25 +155,11 @@ public class Surefire141PluggableProvidersIT
         try
         {
             validator.verifyTextInLog( errorText );
-            return  true;
-        }
-        catch ( SurefireVerifierException e )
-        {
-            return false;
-        }
-    }
-
-    private static boolean verifiedErrorInDump( OutputValidator validator, String errorText )
-    {
-        try
-        {
-            assertErrorMessage( validator, errorText );
             return true;
         }
-        catch ( AssertionError e )
+        catch ( SurefireVerifierException e )
         {
             return false;
         }
     }
-
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java
index 0f30dbc..a53c647 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire975DefaultVMEncodingIT.java
@@ -23,6 +23,8 @@ import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.junit.Test;
 
+import static org.apache.maven.surefire.its.fixture.HelperAssertions.convertUnicodeToUTF8;
+
 public class Surefire975DefaultVMEncodingIT
     extends SurefireJUnit4IntegrationTestCase
 {
@@ -34,7 +36,8 @@ public class Surefire975DefaultVMEncodingIT
         OutputValidator outputValidator =
             unpack( "surefire-975-wrong-encoding" ).setMavenOpts( "-Dfile.encoding=windows-1251" ).executeTest();
         outputValidator.getSurefireReportsXmlFile( "TEST-EncodingInReportTest.xml" ).assertContainsText(
-            "\u043A\u0438\u0440\u0438\u043B\u043B\u0438\u0446\u0435" );
+                // see project.build.sourceEncoding=UTF-8 in src/test/resources/surefire-975-wrong-encoding/pom.xml
+                convertUnicodeToUTF8( "\u043A\u0438\u0440\u0438\u043B\u043B\u0438\u0446\u0435" ) );
     }
 
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-its/src/test/resources/unicode-testnames/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/unicode-testnames/pom.xml b/surefire-its/src/test/resources/unicode-testnames/pom.xml
index eb52b53..cd0a7b8 100644
--- a/surefire-its/src/test/resources/unicode-testnames/pom.xml
+++ b/surefire-its/src/test/resources/unicode-testnames/pom.xml
@@ -30,6 +30,7 @@
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <maven.compiler.source>1.6</maven.compiler.source>
     <maven.compiler.target>1.6</maven.compiler.target>
   </properties>

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
index dc504b6..de18f55 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/ConcurrentRunListenerTest.java
@@ -382,7 +382,7 @@ public class ConcurrentRunListenerTest
 
     private DefaultReporterFactory createReporterFactory()
     {
-        return DefaultReporterFactory.defaultNoXml();
+        return JUnitCoreTester.defaultNoXml();
     }
 
 

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
index 41ae610..17a2197 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
@@ -19,6 +19,8 @@ package org.apache.maven.surefire.junitcore;
  * under the License.
  */
 
+import org.apache.maven.plugin.surefire.StartupReportConfiguration;
+import org.apache.maven.plugin.surefire.log.api.NullConsoleLogger;
 import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.surefire.report.ConsoleOutputReceiver;
 import org.apache.maven.surefire.report.DefaultDirectConsoleReporter;
@@ -29,6 +31,7 @@ import org.junit.runner.Computer;
 import org.junit.runner.JUnitCore;
 import org.junit.runner.Result;
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.concurrent.ExecutionException;
 
@@ -40,7 +43,6 @@ import static org.apache.maven.surefire.report.ConsoleOutputCapture.startCapture
  */
 public class JUnitCoreTester
 {
-
     private final Computer computer;
 
     public JUnitCoreTester()
@@ -56,7 +58,7 @@ public class JUnitCoreTester
     public Result run( boolean parallelClasses, Class<?>... classes )
         throws TestSetFailedException, ExecutionException
     {
-        ReporterFactory reporterManagerFactory = DefaultReporterFactory.defaultNoXml();
+        ReporterFactory reporterManagerFactory = defaultNoXml();
 
         try
         {
@@ -83,5 +85,26 @@ public class JUnitCoreTester
         }
     }
 
+    /**
+     * For testing purposes only.
+     *
+     * @return DefaultReporterFactory for testing purposes
+     */
+    public static DefaultReporterFactory defaultNoXml()
+    {
+        return new DefaultReporterFactory( defaultStartupReportConfiguration(), new NullConsoleLogger() );
+    }
 
+    /**
+     * For testing purposes only.
+     *
+     * @return StartupReportConfiguration fo testing purposes
+     */
+    private static StartupReportConfiguration defaultStartupReportConfiguration()
+    {
+        File target = new File( "./target" );
+        File statisticsFile = new File( target, "TESTHASHxXML" );
+        return new StartupReportConfiguration( true, true, "PLAIN", false, true, target, false, null, statisticsFile,
+                false, 0, null, null );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/bcd27b7f/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
----------------------------------------------------------------------
diff --git a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
index eb5534e..6fba6ab 100644
--- a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
+++ b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/Surefire746Test.java
@@ -21,7 +21,6 @@ import java.io.File;
 import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.maven.plugin.surefire.report.DefaultReporterFactory;
 import org.apache.maven.surefire.booter.BaseProviderFactory;
 import org.apache.maven.surefire.booter.ProviderParameterNames;
 import org.apache.maven.surefire.common.junit4.JUnit4RunListener;
@@ -87,7 +86,7 @@ public class Surefire746Test
     public void surefireIsConfused_ByMultipleIgnore_OnClassLevel()
         throws Exception
     {
-        ReporterFactory reporterFactory = DefaultReporterFactory.defaultNoXml();
+        ReporterFactory reporterFactory = JUnitCoreTester.defaultNoXml();
         BaseProviderFactory providerParameters = new BaseProviderFactory( reporterFactory, true );
 
         providerParameters.setReporterConfiguration( new ReporterConfiguration( new File( "" ), false ) );


[2/2] maven-surefire git commit: [SUREFIRE-1490] Change header of the Failsafe Report

Posted by ti...@apache.org.
[SUREFIRE-1490] Change header of the Failsafe Report


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/be4e4c0c
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/be4e4c0c
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/be4e4c0c

Branch: refs/heads/SUREFIRE-1490
Commit: be4e4c0c773e47fafe598b5cb11473f89b35f3fc
Parents: bcd27b7
Author: Tibor17 <ti...@apache.org>
Authored: Wed Mar 7 02:43:37 2018 +0100
Committer: Tibor17 <ti...@apache.org>
Committed: Sat Mar 17 17:28:47 2018 +0100

----------------------------------------------------------------------
 .../report/AbstractSurefireReportMojo.java      |  22 ++--
 .../surefire/report/FailsafeReportMojo.java     |  59 +++++-----
 .../surefire/report/LocalizedProperties.java    | 116 +++++++++++++++++++
 .../report/SurefireReportGenerator.java         |  90 ++++++--------
 .../surefire/report/SurefireReportMojo.java     |  33 ++++++
 .../main/resources/surefire-report.properties   |   3 +-
 .../resources/surefire-report_de.properties     |   1 +
 .../resources/surefire-report_sv.properties     |   1 +
 .../surefire/report/Surefire597Test.java        |  10 +-
 .../Surefire1490ReportTitleDescriptionIT.java   |  93 +++++++++++++++
 .../src/test/resources/surefire-1490/pom.xml    |  97 ++++++++++++++++
 .../src/test/java/it/Surefire1490IT.java        |  31 +++++
 .../src/test/java/it/Surefire1490Test.java      |  31 +++++
 13 files changed, 484 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/AbstractSurefireReportMojo.java
----------------------------------------------------------------------
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 b6d4a9d..7c78936 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
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.ResourceBundle;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -36,7 +35,6 @@ import org.apache.maven.shared.utils.PathTool;
 import static java.util.Collections.addAll;
 import static org.apache.maven.plugins.surefire.report.SurefireReportParser.hasReportFiles;
 import static org.apache.maven.shared.utils.StringUtils.isEmpty;
-import static org.apache.maven.shared.utils.StringUtils.isNotEmpty;
 
 /**
  * Abstract base class for reporting test results using Surefire.
@@ -136,7 +134,7 @@ public abstract class AbstractSurefireReportMojo
         }
 
         new SurefireReportGenerator( getReportsDirectories(), locale, showSuccess, determineXrefLocation(),
-                                           getConsoleLogger(), isNotEmpty( getTitle() ) ? getTitle() : null )
+                                           getConsoleLogger() )
                 .doGenerateReport( getBundle( locale ), getSink() );
     }
 
@@ -311,9 +309,7 @@ public abstract class AbstractSurefireReportMojo
     @Override
     public String getName( Locale locale )
     {
-        return isEmpty( getTitle() )
-                ? getBundle( locale ).getString( "report.surefire.name" )
-                : getTitle();
+        return getBundle( locale ).getReportName();
     }
 
     /**
@@ -322,9 +318,7 @@ public abstract class AbstractSurefireReportMojo
     @Override
     public String getDescription( Locale locale )
     {
-        return isEmpty( getDescription() )
-                ? getBundle( locale ).getString( "report.surefire.description" )
-                : getDescription();
+        return getBundle( locale ).getReportDescription();
     }
 
     /**
@@ -333,13 +327,15 @@ public abstract class AbstractSurefireReportMojo
     @Override
     public abstract String getOutputName();
 
-    private ResourceBundle getBundle( Locale locale )
-    {
-        return ResourceBundle.getBundle( "surefire-report", locale, getClass().getClassLoader() );
-    }
+    protected abstract LocalizedProperties getBundle( Locale locale, ClassLoader resourceBundleClassLoader );
 
     protected final ConsoleLogger getConsoleLogger()
     {
         return new PluginConsoleLogger( getLog() );
     }
+
+    final LocalizedProperties getBundle( Locale locale )
+    {
+        return getBundle( locale, getClass().getClassLoader() );
+    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
index 2dd7f2d..f534aa2 100644
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/FailsafeReportMojo.java
@@ -92,6 +92,34 @@ public class FailsafeReportMojo
     }
 
     @Override
+    protected LocalizedProperties getBundle( Locale locale, ClassLoader resourceBundleClassLoader )
+    {
+        ResourceBundle bundle = ResourceBundle.getBundle( "surefire-report", locale, resourceBundleClassLoader );
+        return new LocalizedProperties( bundle ) {
+            @Override
+            public String getReportName()
+            {
+                return isEmpty( FailsafeReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.failsafe.name" ) : FailsafeReportMojo.this.getTitle();
+            }
+
+            @Override
+            public String getReportDescription()
+            {
+                return isEmpty( FailsafeReportMojo.this.getDescription() )
+                        ? toLocalizedValue( "report.failsafe.description" ) : FailsafeReportMojo.this.getDescription();
+            }
+
+            @Override
+            public String getReportHeader()
+            {
+                return isEmpty( FailsafeReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.failsafe.header" ) : FailsafeReportMojo.this.getTitle();
+            }
+        };
+    }
+
+    @Override
     protected boolean isSkipped()
     {
         return skipFailsafeReport;
@@ -126,35 +154,4 @@ public class FailsafeReportMojo
     {
         return description;
     }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getName( Locale locale )
-    {
-        return isEmpty( getTitle() )
-                ? getBundle( locale ).getString( "report.failsafe.name" )
-                : getTitle();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getDescription( Locale locale )
-    {
-        return isEmpty( getDescription() )
-                ? getDescription()
-                : getBundle( locale ).getString( "report.failsafe.description" );
-    }
-
-    /*
-    * This is currently a copy of the getBundle() method of the AbstractSurefireReportMojo class,
-    * cause the failsafe report only different in two names for the bundles.
-    */
-    private ResourceBundle getBundle( Locale locale )
-    {
-        return ResourceBundle.getBundle( "surefire-report", locale, getClass().getClassLoader() );
-    }
 }

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
new file mode 100644
index 0000000..d73dc5e
--- /dev/null
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/LocalizedProperties.java
@@ -0,0 +1,116 @@
+package org.apache.maven.plugins.surefire.report;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.ResourceBundle;
+
+/**
+ * Surefire Resource Bundle.
+ *
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ */
+public abstract class LocalizedProperties
+{
+    private final ResourceBundle bundle;
+
+    protected LocalizedProperties( ResourceBundle bundle )
+    {
+        this.bundle = bundle;
+    }
+
+    public abstract String getReportName();
+    public abstract String getReportDescription();
+    public abstract String getReportHeader();
+
+    protected final String toLocalizedValue( String key )
+    {
+        return bundle.getString( key );
+    }
+
+    public String getReportLabelSummary()
+    {
+        return toLocalizedValue( "report.surefire.label.summary" );
+    }
+
+    public String getReportLabelTests()
+    {
+        return toLocalizedValue( "report.surefire.label.tests" );
+    }
+
+    public String getReportLabelErrors()
+    {
+        return toLocalizedValue( "report.surefire.label.errors" );
+    }
+
+    public String getReportLabelFailures()
+    {
+        return toLocalizedValue( "report.surefire.label.failures" );
+    }
+
+    public String getReportLabelSkipped()
+    {
+        return toLocalizedValue( "report.surefire.label.skipped" );
+    }
+
+    public String getReportLabelSuccessRate()
+    {
+        return toLocalizedValue( "report.surefire.label.successrate" );
+    }
+
+    public String getReportLabelTime()
+    {
+        return toLocalizedValue( "report.surefire.label.time" );
+    }
+
+    public String getReportLabelPackageList()
+    {
+        return toLocalizedValue( "report.surefire.label.packagelist" );
+    }
+
+    public String getReportLabelPackage()
+    {
+        return toLocalizedValue( "report.surefire.label.package" );
+    }
+
+    public String getReportLabelClass()
+    {
+        return toLocalizedValue( "report.surefire.label.class" );
+    }
+
+    public String getReportLabelTestCases()
+    {
+        return toLocalizedValue( "report.surefire.label.testcases" );
+    }
+
+    public String getReportLabelFailureDetails()
+    {
+        return toLocalizedValue( "report.surefire.label.failuredetails" );
+    }
+
+    public String getReportTextNode1()
+    {
+        return toLocalizedValue( "report.surefire.text.note1" );
+    }
+
+    public String getReportTextNode2()
+    {
+        return toLocalizedValue( "report.surefire.text.note2" );
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportGenerator.java
----------------------------------------------------------------------
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/SurefireReportGenerator.java
index 5929f79..f9b9480 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/SurefireReportGenerator.java
@@ -24,7 +24,6 @@ import java.text.NumberFormat;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.ResourceBundle;
 import org.apache.maven.doxia.markup.HtmlMarkup;
 import org.apache.maven.doxia.sink.Sink;
 import org.apache.maven.doxia.sink.SinkEventAttributeSet;
@@ -40,7 +39,6 @@ import static org.apache.maven.doxia.sink.SinkEventAttributes.ID;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.NAME;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.STYLE;
 import static org.apache.maven.doxia.sink.SinkEventAttributes.TYPE;
-import static org.apache.maven.shared.utils.StringUtils.isEmpty;
 
 /**
  * This generator creates HTML Report from Surefire and Failsafe XML Report.
@@ -48,35 +46,23 @@ import static org.apache.maven.shared.utils.StringUtils.isEmpty;
 public final class SurefireReportGenerator
 {
     private static final int LEFT = JUSTIFY_LEFT;
-
     private static final Object[] TAG_TYPE_START = { HtmlMarkup.TAG_TYPE_START };
-
     private static final Object[] TAG_TYPE_END = { HtmlMarkup.TAG_TYPE_END };
 
     private final SurefireReportParser report;
-
     private final boolean showSuccess;
-
     private final String xrefLocation;
-    private final String title;
     private List<ReportTestSuite> testSuites;
 
     public SurefireReportGenerator( List<File> reportsDirectories, Locale locale, boolean showSuccess,
-                                    String xrefLocation, ConsoleLogger consoleLogger, String title )
+                                    String xrefLocation, ConsoleLogger consoleLogger )
     {
         report = new SurefireReportParser( reportsDirectories, locale, consoleLogger );
         this.showSuccess = showSuccess;
         this.xrefLocation = xrefLocation;
-        this.title = title;
-    }
-
-    public SurefireReportGenerator( List<File> reportsDirectories, Locale locale, boolean showSuccess,
-                                    String xrefLocation, ConsoleLogger consoleLogger )
-    {
-        this( reportsDirectories, locale, showSuccess, xrefLocation, consoleLogger, null );
     }
 
-    public void doGenerateReport( ResourceBundle bundle, Sink sink )
+    public void doGenerateReport( LocalizedProperties bundle, Sink sink )
         throws MavenReportException
     {
         testSuites = report.parseXMLReportFiles();
@@ -84,7 +70,7 @@ public final class SurefireReportGenerator
         sink.head();
 
         sink.title();
-        sink.text( isEmpty( title ) ? bundle.getString( "report.surefire.header" ) : title );
+        sink.text( bundle.getReportHeader() );
         sink.title_();
 
         sink.head_();
@@ -99,7 +85,7 @@ public final class SurefireReportGenerator
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( isEmpty( title ) ? bundle.getString( "report.surefire.header" ) : title );
+        sink.text( bundle.getReportHeader() );
         sink.sectionTitle1_();
         sink.section1_();
 
@@ -129,13 +115,13 @@ public final class SurefireReportGenerator
         sink.close();
     }
 
-    private void constructSummarySection( ResourceBundle bundle, Sink sink )
+    private void constructSummarySection( LocalizedProperties bundle, Sink sink )
     {
         Map<String, String> summary = report.getSummary( testSuites );
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.summary" ) );
+        sink.text( bundle.getReportLabelSummary() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Summary" );
@@ -150,17 +136,17 @@ public final class SurefireReportGenerator
 
         sink.tableRow();
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.tests" ) );
+        sinkHeader( sink, bundle.getReportLabelTests() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.errors" ) );
+        sinkHeader( sink, bundle.getReportLabelErrors() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.failures" ) );
+        sinkHeader( sink, bundle.getReportLabelFailures() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.skipped" ) );
+        sinkHeader( sink, bundle.getReportLabelSkipped() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.successrate" ) );
+        sinkHeader( sink, bundle.getReportLabelSuccessRate() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.time" ) );
+        sinkHeader( sink, bundle.getReportLabelTime() );
 
         sink.tableRow_();
 
@@ -187,7 +173,7 @@ public final class SurefireReportGenerator
         sink.lineBreak();
 
         sink.paragraph();
-        sink.text( bundle.getString( "report.surefire.text.note1" ) );
+        sink.text( bundle.getReportTextNode1() );
         sink.paragraph_();
 
         sinkLineBreak( sink );
@@ -195,14 +181,14 @@ public final class SurefireReportGenerator
         sink.section1_();
     }
 
-    private void constructPackagesSection( ResourceBundle bundle, Sink sink,
+    private void constructPackagesSection( LocalizedProperties bundle, Sink sink,
                                            Map<String, List<ReportTestSuite>> suitePackages )
     {
         NumberFormat numberFormat = report.getNumberFormat();
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.packagelist" ) );
+        sink.text( bundle.getReportLabelPackageList() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Package_List" );
@@ -217,19 +203,19 @@ public final class SurefireReportGenerator
 
         sink.tableRow();
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.package" ) );
+        sinkHeader( sink, bundle.getReportLabelPackage() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.tests" ) );
+        sinkHeader( sink, bundle.getReportLabelTests() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.errors" ) );
+        sinkHeader( sink, bundle.getReportLabelErrors() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.failures" ) );
+        sinkHeader( sink, bundle.getReportLabelFailures() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.skipped" ) );
+        sinkHeader( sink, bundle.getReportLabelSkipped() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.successrate" ) );
+        sinkHeader( sink, bundle.getReportLabelSuccessRate() );
 
-        sinkHeader( sink, bundle.getString( "report.surefire.label.time" ) );
+        sinkHeader( sink, bundle.getReportLabelTime() );
 
         sink.tableRow_();
 
@@ -267,7 +253,7 @@ public final class SurefireReportGenerator
         sink.lineBreak();
 
         sink.paragraph();
-        sink.text( bundle.getString( "report.surefire.text.note2" ) );
+        sink.text( bundle.getReportTextNode2() );
         sink.paragraph_();
 
         for ( Map.Entry<String, List<ReportTestSuite>> entry : suitePackages.entrySet() )
@@ -305,19 +291,19 @@ public final class SurefireReportGenerator
 
                 sinkHeader( sink, "" );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.class" ) );
+                sinkHeader( sink, bundle.getReportLabelClass() );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.tests" ) );
+                sinkHeader( sink, bundle.getReportLabelTests() );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.errors" ) );
+                sinkHeader( sink, bundle.getReportLabelErrors() );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.failures" ) );
+                sinkHeader( sink, bundle.getReportLabelFailures() );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.skipped" ) );
+                sinkHeader( sink, bundle.getReportLabelSkipped() );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.successrate" ) );
+                sinkHeader( sink, bundle.getReportLabelSuccessRate() );
 
-                sinkHeader( sink, bundle.getString( "report.surefire.label.time" ) );
+                sinkHeader( sink, bundle.getReportLabelTime() );
 
                 sink.tableRow_();
 
@@ -390,13 +376,13 @@ public final class SurefireReportGenerator
         sink.tableRow_();
     }
 
-    private void constructTestCasesSection( ResourceBundle bundle, Sink sink )
+    private void constructTestCasesSection( LocalizedProperties bundle, Sink sink )
     {
         NumberFormat numberFormat = report.getNumberFormat();
 
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.testcases" ) );
+        sink.text( bundle.getReportLabelTestCases() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Test_Cases" );
@@ -562,11 +548,11 @@ public final class SurefireReportGenerator
         return DoxiaUtils.isValidId( id ) ? id : DoxiaUtils.encodeId( id, true );
     }
 
-    private void constructFailureDetails( Sink sink, ResourceBundle bundle, List<ReportTestCase> failures )
+    private void constructFailureDetails( Sink sink, LocalizedProperties bundle, List<ReportTestCase> failures )
     {
         sink.section1();
         sink.sectionTitle1();
-        sink.text( bundle.getString( "report.surefire.label.failuredetails" ) );
+        sink.text( bundle.getReportLabelFailureDetails() );
         sink.sectionTitle1_();
 
         sinkAnchor( sink, "Failure_Details" );
@@ -647,22 +633,22 @@ public final class SurefireReportGenerator
         sink.section1_();
     }
 
-    private void constructHotLinks( Sink sink, ResourceBundle bundle )
+    private void constructHotLinks( Sink sink, LocalizedProperties bundle )
     {
         if ( !testSuites.isEmpty() )
         {
             sink.paragraph();
 
             sink.text( "[" );
-            sinkLink( sink, bundle.getString( "report.surefire.label.summary" ), "#Summary" );
+            sinkLink( sink, bundle.getReportLabelSummary(), "#Summary" );
             sink.text( "]" );
 
             sink.text( " [" );
-            sinkLink( sink, bundle.getString( "report.surefire.label.packagelist" ), "#Package_List" );
+            sinkLink( sink, bundle.getReportLabelPackageList(), "#Package_List" );
             sink.text( "]" );
 
             sink.text( " [" );
-            sinkLink( sink, bundle.getString( "report.surefire.label.testcases" ), "#Test_Cases" );
+            sinkLink( sink, bundle.getReportLabelTestCases(), "#Test_Cases" );
             sink.text( "]" );
 
             sink.paragraph_();

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
index 2329095..3c93737 100644
--- a/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
+++ b/maven-surefire-report-plugin/src/main/java/org/apache/maven/plugins/surefire/report/SurefireReportMojo.java
@@ -20,12 +20,17 @@ package org.apache.maven.plugins.surefire.report;
  */
 
 import java.io.File;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
 import org.apache.maven.plugins.annotations.Execute;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.maven.project.MavenProject;
 
+import static org.apache.maven.shared.utils.StringUtils.isEmpty;
+
 /**
  * Creates a nicely formatted Surefire Test Report in html format.
  *
@@ -87,6 +92,34 @@ public class SurefireReportMojo
     }
 
     @Override
+    protected LocalizedProperties getBundle( Locale locale, ClassLoader resourceBundleClassLoader )
+    {
+        ResourceBundle bundle = ResourceBundle.getBundle( "surefire-report", locale, resourceBundleClassLoader );
+        return new LocalizedProperties( bundle ) {
+            @Override
+            public String getReportName()
+            {
+                return isEmpty( SurefireReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.surefire.name" ) : SurefireReportMojo.this.getTitle();
+            }
+
+            @Override
+            public String getReportDescription()
+            {
+                return isEmpty( SurefireReportMojo.this.getDescription() )
+                        ? toLocalizedValue( "report.surefire.description" ) : SurefireReportMojo.this.getDescription();
+            }
+
+            @Override
+            public String getReportHeader()
+            {
+                return isEmpty( SurefireReportMojo.this.getTitle() )
+                        ? toLocalizedValue( "report.surefire.header" ) : SurefireReportMojo.this.getTitle();
+            }
+        };
+    }
+
+    @Override
     protected boolean isSkipped()
     {
         return skipSurefireReport;

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/resources/surefire-report.properties b/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
index f2f65c6..8aa256e 100644
--- a/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
+++ b/maven-surefire-report-plugin/src/main/resources/surefire-report.properties
@@ -22,7 +22,7 @@ report.surefire.description=Report on the test results of the project.
 report.surefire.header=Surefire Report
 report.surefire.label.summary=Summary
 report.surefire.label.tests=Tests
-report.surefire.label.errors=Errors 
+report.surefire.label.errors=Errors
 report.surefire.label.failures=Failures
 report.surefire.label.skipped=Skipped
 report.surefire.label.successrate=Success Rate
@@ -37,3 +37,4 @@ report.surefire.text.note2=Note: package statistics are not computed recursively
 
 report.failsafe.name=Failsafe Report
 report.failsafe.description=Report on the integration test results of the project.
+report.failsafe.header=Failsafe Report

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties b/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
index cde7830..baff5db 100644
--- a/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
+++ b/maven-surefire-report-plugin/src/main/resources/surefire-report_de.properties
@@ -37,3 +37,4 @@ report.surefire.text.note2 =Hinweis: Die Paketstatistiken werden nicht rekursiv
 
 report.failsafe.name=Failsafe Bericht
 report.failsafe.description=Bericht \u00FCber die Integrationstestresultate des Projekts.
+report.failsafe.header=Failsafe Bericht

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
----------------------------------------------------------------------
diff --git a/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties b/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
index 3664c6b..5e3bcbe 100644
--- a/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
+++ b/maven-surefire-report-plugin/src/main/resources/surefire-report_sv.properties
@@ -37,3 +37,4 @@ report.surefire.text.note2=Notera: paketstatistiken ber\u00e4knas inte rekursivt
 
 report.failsafe.name=Failsafe-rapport
 report.failsafe.description=Rapport om integration testresultaten f\u00f6r projektet.
+report.failsafe.header=Failsafe-rapport

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/maven-surefire-report-plugin/src/test/java/org/apache/maven/plugins/surefire/report/Surefire597Test.java
----------------------------------------------------------------------
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 4d75a30..02af6c4 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
@@ -26,7 +26,6 @@ import org.junit.Test;
 
 import java.io.File;
 import java.io.StringWriter;
-import java.util.ResourceBundle;
 
 import static java.util.Collections.singletonList;
 import static java.util.Locale.ENGLISH;
@@ -47,15 +46,14 @@ public class Surefire597Test
         File report = new File( basedir, "target/test-classes/surefire-597" );
         ConsoleLogger log = new NullConsoleLogger();
         SurefireReportGenerator gen = new SurefireReportGenerator( singletonList( report ), ENGLISH, true, null, log );
-        ResourceBundle resourceBundle = ResourceBundle.getBundle( "surefire-report", ENGLISH );
         StringWriter writer = new StringWriter();
-        gen.doGenerateReport( resourceBundle, new XhtmlSink( writer ) {} );
+        gen.doGenerateReport( new SurefireReportMojo().getBundle( ENGLISH ), new XhtmlSink( writer ) {} );
         String xml = writer.toString();
         assertThat( xml, containsString( toSystemNewLine(
             "<table border=\"1\" class=\"bodyTable\">\n"
                 + "<tr class=\"a\">\n"
                 + "<th>Tests</th>\n"
-                + "<th>Errors </th>\n"
+                + "<th>Errors</th>\n"
                 + "<th>Failures</th>\n"
                 + "<th>Skipped</th>\n"
                 + "<th>Success Rate</th>\n"
@@ -74,7 +72,7 @@ public class Surefire597Test
                 + "<tr class=\"a\">\n"
                 + "<th>Package</th>\n"
                 + "<th>Tests</th>\n"
-                + "<th>Errors </th>\n"
+                + "<th>Errors</th>\n"
                 + "<th>Failures</th>\n"
                 + "<th>Skipped</th>\n"
                 + "<th>Success Rate</th>\n"
@@ -93,7 +91,7 @@ public class Surefire597Test
                 + "<th></th>\n"
                 + "<th>Class</th>\n"
                 + "<th>Tests</th>\n"
-                + "<th>Errors </th>\n"
+                + "<th>Errors</th>\n"
                 + "<th>Failures</th>\n"
                 + "<th>Skipped</th>\n"
                 + "<th>Success Rate</th>\n"

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java
new file mode 100644
index 0000000..289edec
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1490ReportTitleDescriptionIT.java
@@ -0,0 +1,93 @@
+package org.apache.maven.surefire.its.jiras;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.surefire.its.fixture.OutputValidator;
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.apache.maven.surefire.its.fixture.SurefireLauncher;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
+ * @see <a href="https://issues.apache.org/jira/browse/SUREFIRE-1490">SUREFIRE-1490</a>
+ * @since 3.0.0-M1
+ */
+public class Surefire1490ReportTitleDescriptionIT
+        extends SurefireJUnit4IntegrationTestCase
+{
+    @Test
+    public void shouldHaveDefaultReportTitleAndDescription()
+    {
+        OutputValidator validator = unpack()
+                .addGoal( "verify" )
+                .execute( "site" )
+                .verifyErrorFreeLog();
+
+        validator.getSiteFile( "project-reports.html" )
+                .assertContainsText( "Surefire Report" )
+                .assertContainsText( "Report on the test results of the project." )
+                .assertContainsText( "Failsafe Report" )
+                .assertContainsText( "Report on the integration test results of the project." );
+
+        validator.getSiteFile( "failsafe-report.html" )
+                .assertContainsText( "Failsafe Report" )
+                .assertContainsText( "Surefire1490IT" );
+
+        validator.getSiteFile( "surefire-report.html" )
+                .assertContainsText( "Surefire Report" )
+                .assertContainsText( "Surefire1490Test" );
+    }
+
+    @Test
+    public void shouldHaveCustomizedReportTitleAndDescription()
+    {
+        OutputValidator validator = unpack()
+                .sysProp( "failsafe.report.title", "failsafe title" )
+                .sysProp( "failsafe.report.description", "failsafe desc" )
+                .sysProp( "surefire.report.title", "surefire title" )
+                .sysProp( "surefire.report.description", "surefire desc" )
+                .addGoal( "verify" )
+                .execute( "site" )
+                .verifyErrorFreeLog();
+
+        validator.getSiteFile( "project-reports.html" )
+                .assertContainsText( "surefire title" )
+                .assertContainsText( "surefire desc" )
+                .assertContainsText( "failsafe title" )
+                .assertContainsText( "failsafe desc" );
+
+        validator.getSiteFile( "failsafe-report.html" )
+                .assertContainsText( "failsafe title" )
+                .assertContainsText( "Surefire1490IT" );
+
+        validator.getSiteFile( "surefire-report.html" )
+                .assertContainsText( "surefire title" )
+                .assertContainsText( "Surefire1490Test" );
+    }
+
+    public SurefireLauncher unpack()
+    {
+        SurefireLauncher unpack = unpack( "surefire-1490" );
+        unpack.sysProp( "user.language", "en" )
+                .maven()
+                .execute( "clean" );
+        return unpack;
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/resources/surefire-1490/pom.xml
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/surefire-1490/pom.xml b/surefire-its/src/test/resources/surefire-1490/pom.xml
new file mode 100644
index 0000000..8ec6244
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1490/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.maven.surefire</groupId>
+        <artifactId>it-parent</artifactId>
+        <version>1.0</version>
+    </parent>
+
+    <groupId>org.apache.maven.plugins.surefire</groupId>
+    <artifactId>surefire-1490</artifactId>
+    <version>1.0</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.12</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-failsafe-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <executions>
+                    <execution>
+                        <id>integration-tests</id>
+                        <goals>
+                            <goal>integration-test</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>verify-integration-tests</id>
+                        <goals>
+                            <goal>verify</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <artifactId>maven-surefire-report-plugin</artifactId>
+                <version>${surefire.version}</version>
+                <reportSets>
+                    <reportSet>
+                        <id>reports</id>
+                        <reports>
+                            <report>report-only</report>
+                            <report>failsafe-report-only</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <version>2.9</version>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>index</report>
+                            <report>summary</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+        </plugins>
+    </reporting>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java
new file mode 100644
index 0000000..2a6818d
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490IT.java
@@ -0,0 +1,31 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.Test;
+
+public class Surefire1490IT
+{
+    @Test
+    public void test()
+    {
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/be4e4c0c/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java
----------------------------------------------------------------------
diff --git a/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java
new file mode 100644
index 0000000..26de27f
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-1490/src/test/java/it/Surefire1490Test.java
@@ -0,0 +1,31 @@
+package it;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.junit.Test;
+
+public class Surefire1490Test
+{
+    @Test
+    public void test()
+    {
+
+    }
+}