Updated Branches:
  refs/heads/master 531826a77 -> c45efb22b

o Simplified logic


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

Branch: refs/heads/master
Commit: c45efb22b5093ccdee53f8e4d1d4ce0017f90d06
Parents: 531826a
Author: Kristian Rosenvold <krosenv...@apache.org>
Authored: Fri Nov 2 21:04:16 2012 +0100
Committer: Kristian Rosenvold <krosenv...@apache.org>
Committed: Fri Nov 2 21:04:16 2012 +0100

----------------------------------------------------------------------
 .../surefire/StartupReportConfiguration.java       |   40 +++++----------
 1 files changed, 13 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/c45efb22/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 699fe22..a27ff54 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
@@ -19,6 +19,9 @@ package org.apache.maven.plugin.surefire;
  * under the License.
  */
 
+import java.io.File;
+import java.io.PrintStream;
+import java.util.Properties;
 import org.apache.maven.plugin.surefire.report.ConsoleOutputFileReporter;
 import org.apache.maven.plugin.surefire.report.ConsoleReporter;
 import org.apache.maven.plugin.surefire.report.DirectConsoleOutput;
@@ -27,10 +30,6 @@ import 
org.apache.maven.plugin.surefire.report.StatelessXmlReporter;
 import org.apache.maven.plugin.surefire.report.TestcycleConsoleOutputReceiver;
 import org.apache.maven.plugin.surefire.runorder.StatisticsReporter;
 
-import java.io.File;
-import java.io.PrintStream;
-import java.util.Properties;
-
 /**
  * All the parameters used to construct reporters
  * <p/>
@@ -148,40 +147,27 @@ public class StartupReportConfiguration
 
     public FileReporter instantiateFileReporter()
     {
-        if ( isUseFile() )
+        if ( isUseFile() && isBriefOrPlainFormat() )
         {
-            if ( BRIEF_REPORT_FORMAT.equals( getReportFormat() ) )
-            {
-                return new FileReporter( reportsDirectory, 
getReportNameSuffix() );
-            }
-            else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
-            {
-                return new FileReporter( reportsDirectory, 
getReportNameSuffix() );
-            }
+            return new FileReporter( reportsDirectory, getReportNameSuffix() );
         }
         return null;
     }
 
     public boolean isBriefOrPlainFormat()
     {
-        return BRIEF_REPORT_FORMAT.equals( getReportFormat() ) || 
PLAIN_REPORT_FORMAT.equals( getReportFormat() );
+        String fmt = getReportFormat();
+        return BRIEF_REPORT_FORMAT.equals( fmt ) || 
PLAIN_REPORT_FORMAT.equals( fmt );
     }
 
     public ConsoleReporter instantiateConsoleReporter()
     {
-        if ( isUseFile() )
-        {
-            return isPrintSummary() ? new ConsoleReporter() : null;
-        }
-        else if ( isRedirectTestOutputToFile() || BRIEF_REPORT_FORMAT.equals( 
getReportFormat() ) )
-        {
-            return new ConsoleReporter();
-        }
-        else if ( PLAIN_REPORT_FORMAT.equals( getReportFormat() ) )
-        {
-            return new ConsoleReporter();
-        }
-        return null;
+        return shouldReportToConsole() ? new ConsoleReporter() : null;
+    }
+
+    private boolean shouldReportToConsole()
+    {
+        return isUseFile() ? isPrintSummary() : isRedirectTestOutputToFile() 
|| isBriefOrPlainFormat();
     }
 
     public TestcycleConsoleOutputReceiver 
instantiateConsoleOutputFileReporter()

Reply via email to