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/06/11 19:38:25 UTC

[maven-surefire] branch master updated: refactoring cutting release version

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3227803  refactoring cutting release version
3227803 is described below

commit 3227803c0fc6327811f6b525cd1bb996deaebefd
Author: Tibor17 <ti...@apache.org>
AuthorDate: Mon Jun 11 21:38:03 2018 +0200

    refactoring cutting release version
---
 .../surefire/report/DefaultReporterFactory.java    |  9 +--
 .../maven/plugin/surefire/report/FileReporter.java |  2 +-
 .../surefire/report/StatelessXmlReporter.java      | 16 ++---
 .../plugin/surefire/report/TestSetRunListener.java | 25 +++-----
 .../maven/plugin/surefire/report/TestSetStats.java | 15 ++---
 .../report/TestcycleConsoleOutputReceiver.java     |  2 -
 .../plugin/surefire/report/WrappedReportEntry.java |  8 +--
 .../src/site/apt/examples/shutdown.apt.vm          |  2 +-
 .../surefire/report/ConsoleOutputCapture.java      | 21 ++++---
 .../apache/maven/surefire/booter/ForkedBooter.java | 10 +++-
 .../maven/surefire/booter/ProviderFactory.java     |  4 +-
 .../surefire/booter/StartupConfiguration.java      |  2 +-
 .../surefire/its/fixture/HelperAssertions.java     |  4 +-
 .../surefire/common/junit3/JUnit3TestChecker.java  | 20 +++----
 .../apache/maven/surefire/junit/PojoTestSet.java   | 69 +++++++---------------
 .../surefire/junitcore/ConcurrentRunListener.java  |  2 +-
 .../junitcore/NonConcurrentRunListener.java        |  2 +-
 .../junitcore/pc/ParallelComputerBuilder.java      |  9 +--
 18 files changed, 87 insertions(+), 135 deletions(-)

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 8812156..15b4306 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
@@ -247,14 +247,7 @@ public class DefaultReporterFactory
             }
             else
             {
-                if ( seenError )
-                {
-                    return error;
-                }
-                else
-                {
-                    return failure;
-                }
+                return seenError ? error : failure;
             }
         }
         else if ( seenSuccess )
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 8a34c0b..47ed4e7 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
@@ -83,7 +83,7 @@ public class FileReporter
         }
     }
 
-    public static File getReportFile( File reportsDirectory, String reportEntryName, String reportNameSuffix,
+    static File getReportFile( File reportsDirectory, String reportEntryName, String reportNameSuffix,
                                       String fileExtension )
     {
         String fileName =
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index eab3b3b..dad9808 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -44,12 +44,13 @@ import java.util.StringTokenizer;
 import static org.apache.commons.io.IOUtils.closeQuietly;
 import static org.apache.maven.plugin.surefire.report.DefaultReporterFactory.TestResultType;
 import static org.apache.maven.plugin.surefire.report.FileReporterUtils.stripIllegalFilenameChars;
+import static org.apache.maven.plugin.surefire.report.ReportEntryType.SUCCESS;
 import static org.apache.maven.surefire.util.internal.StringUtils.UTF_8;
 import static org.apache.maven.surefire.util.internal.StringUtils.isBlank;
 
 @SuppressWarnings( { "javadoc", "checkstyle:javadoctype" } )
 // CHECKSTYLE_OFF: LineLength
-/**
+/*
  * XML format reporter writing to <code>TEST-<i>reportName</i>[-<i>suffix</i>].xml</code> file like written and read
  * by Ant's <a href="http://ant.apache.org/manual/Tasks/junit.html"><code>&lt;junit&gt;</code></a> and
  * <a href="http://ant.apache.org/manual/Tasks/junitreport.html"><code>&lt;junitreport&gt;</code></a> tasks,
@@ -146,13 +147,12 @@ public class StatelessXmlReporter
                 {
                     if ( rerunFailingTestsCount > 0 )
                     {
-                        TestResultType resultType = getTestResultType( methodEntryList );
-                        switch ( resultType )
+                        switch ( getTestResultType( methodEntryList ) )
                         {
                             case success:
                                 for ( WrappedReportEntry methodEntry : methodEntryList )
                                 {
-                                    if ( methodEntry.getReportEntryType() == ReportEntryType.SUCCESS )
+                                    if ( methodEntry.getReportEntryType() == SUCCESS )
                                     {
                                         startTestElement( ppw, methodEntry, reportNameSuffix,
                                                           methodEntryList.get( 0 ).elapsedTimeAsString() );
@@ -188,7 +188,7 @@ public class StatelessXmlReporter
                                 // Get the run time of the first successful run
                                 for ( WrappedReportEntry singleRunEntry : methodEntryList )
                                 {
-                                    if ( singleRunEntry.getReportEntryType() == ReportEntryType.SUCCESS )
+                                    if ( singleRunEntry.getReportEntryType() == SUCCESS )
                                     {
                                         runtime = singleRunEntry.elapsedTimeAsString();
                                         break;
@@ -197,7 +197,7 @@ public class StatelessXmlReporter
                                 startTestElement( ppw, methodEntryList.get( 0 ), reportNameSuffix, runtime );
                                 for ( WrappedReportEntry singleRunEntry : methodEntryList )
                                 {
-                                    if ( singleRunEntry.getReportEntryType() != ReportEntryType.SUCCESS )
+                                    if ( singleRunEntry.getReportEntryType() != SUCCESS )
                                     {
                                         getTestProblems( fw, ppw, singleRunEntry, trimStackTrace, outputStream,
                                                          singleRunEntry.getReportEntryType().getFlakyXmlTag(), true );
@@ -224,7 +224,7 @@ public class StatelessXmlReporter
                         for ( WrappedReportEntry methodEntry : methodEntryList )
                         {
                             startTestElement( ppw, methodEntry, reportNameSuffix, methodEntry.elapsedTimeAsString() );
-                            if ( methodEntry.getReportEntryType() != ReportEntryType.SUCCESS )
+                            if ( methodEntry.getReportEntryType() != SUCCESS )
                             {
                                 getTestProblems( fw, ppw, methodEntry, trimStackTrace, outputStream,
                                                  methodEntry.getReportEntryType().getXmlTag(), false );
@@ -507,7 +507,7 @@ public class StatelessXmlReporter
             super( out );
         }
 
-        public OutputStream getUnderlying()
+        OutputStream getUnderlying()
         {
             return out;
         }
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
index daf4b2a..329ba79 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
@@ -160,12 +160,12 @@ public class TestSetRunListener
             {
                 testStdErr.write( buf, off, len );
             }
+            consoleOutputReceiver.writeTestOutput( buf, off, len, stdout );
         }
         catch ( IOException e )
         {
             throw new RuntimeException( e );
         }
-        consoleOutputReceiver.writeTestOutput( buf, off, len, stdout );
     }
 
     @Override
@@ -176,7 +176,7 @@ public class TestSetRunListener
         consoleOutputReceiver.testSetStarting( report );
     }
 
-    public void clearCapture()
+    private void clearCapture()
     {
         testStdOut = initDeferred( "stdout" );
         testStdErr = initDeferred( "stderr" );
@@ -248,7 +248,6 @@ public class TestSetRunListener
     public void testSkipped( ReportEntry reportEntry )
     {
         WrappedReportEntry wrapped = wrap( reportEntry, SKIPPED );
-
         detailsForThis.testSkipped( wrapped );
         statisticsReporter.testSkipped( reportEntry );
         clearCapture();
@@ -267,21 +266,11 @@ public class TestSetRunListener
 
     private WrappedReportEntry wrap( ReportEntry other, ReportEntryType reportEntryType )
     {
-        final int estimatedElapsed;
+        int estimatedElapsed = 0;
         if ( reportEntryType != SKIPPED )
         {
-            if ( other.getElapsed() != null )
-            {
-                estimatedElapsed = other.getElapsed();
-            }
-            else
-            {
-                estimatedElapsed = detailsForThis.getElapsedSinceLastStart();
-            }
-        }
-        else
-        {
-            estimatedElapsed = 0;
+            Integer etime = other.getElapsed();
+            estimatedElapsed = etime == null ? detailsForThis.getElapsedSinceLastStart() : etime;
         }
 
         return new WrappedReportEntry( other, reportEntryType, estimatedElapsed, testStdOut, testStdErr );
@@ -299,7 +288,7 @@ public class TestSetRunListener
         consoleOutputReceiver.close();
     }
 
-    public void  addTestMethodStats()
+    private void addTestMethodStats()
     {
         for ( WrappedReportEntry reportEntry : detailsForThis.getReportEntries() )
         {
@@ -315,7 +304,7 @@ public class TestSetRunListener
         return testMethodStats;
     }
 
-    public static String trimTrailingNewLine( final String message )
+    private static String trimTrailingNewLine( final String message )
     {
         final int e = message == null ? 0 : lineBoundSymbolWidth( message );
         return message != null && e != 0 ? message.substring( 0, message.length() - e ) : message;
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
index 691c4b6..4634b26 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetStats.java
@@ -93,19 +93,16 @@ public class TestSetStats
         lastStartAt = testStartAt;
     }
 
-    private long finishTest( WrappedReportEntry reportEntry )
+    private void finishTest( WrappedReportEntry reportEntry )
     {
         reportEntries.add( reportEntry );
         incrementCompletedCount();
-        long testEndAt = System.currentTimeMillis();
         // SUREFIRE-398 skipped tests call endTest without calling testStarting
         // if startTime = 0, set it to endTime, so the diff will be 0
         if ( testStartAt == 0 )
         {
-            testStartAt = testEndAt;
+            testStartAt = System.currentTimeMillis();
         }
-        Integer elapsedTime = reportEntry.getElapsed();
-        return elapsedTime != null ? elapsedTime : testEndAt - testStartAt;
     }
 
     public void testSucceeded( WrappedReportEntry reportEntry )
@@ -167,11 +164,6 @@ public class TestSetStats
         return skipped;
     }
 
-    public String elapsedTimeAsString( long runTime )
-    {
-        return ReporterUtils.formatElapsedTime( runTime );
-    }
-
     private void incrementCompletedCount()
     {
         completedCount += 1;
@@ -284,6 +276,7 @@ public class TestSetStats
                 result.add( testResult.getElapsedTimeSummary() );
             }
         }
+        // This should be Map with an enum and the enums will be displayed with colors on console.
         return result;
     }
 
@@ -300,7 +293,7 @@ public class TestSetStats
      * @param report     report whose test set is starting
      * @return the message
      */
-    public static String concatenateWithTestGroup( MessageBuilder builder, ReportEntry report )
+    static String concatenateWithTestGroup( MessageBuilder builder, ReportEntry report )
     {
         final String testClass = report.getNameWithGroup();
         int delimiter = testClass.lastIndexOf( '.' );
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestcycleConsoleOutputReceiver.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestcycleConsoleOutputReceiver.java
index d2c59ff..f1b5b5a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestcycleConsoleOutputReceiver.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestcycleConsoleOutputReceiver.java
@@ -28,11 +28,9 @@ import org.apache.maven.surefire.report.ReportEntry;
 public interface TestcycleConsoleOutputReceiver
     extends ConsoleOutputReceiver
 {
-
     void testSetStarting( ReportEntry reportEntry );
 
     void testSetCompleted( ReportEntry report );
 
     void close();
-
 }
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
index 1322d36..3426e3a 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/WrappedReportEntry.java
@@ -27,6 +27,7 @@ import java.util.Collections;
 import java.util.Map;
 
 import static java.util.Collections.unmodifiableMap;
+import static org.apache.maven.plugin.surefire.report.ReporterUtils.formatElapsedTime;
 import static org.apache.maven.surefire.util.internal.StringUtils.NL;
 
 /**
@@ -131,12 +132,7 @@ public class WrappedReportEntry
 
     public String elapsedTimeAsString()
     {
-        return elapsedTimeAsString( getElapsed() );
-    }
-
-    String elapsedTimeAsString( long runTime )
-    {
-        return ReporterUtils.formatElapsedTime( runTime );
+        return formatElapsedTime( getElapsed() );
     }
 
     public String getReportName()
diff --git a/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm b/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
index 7a7b59e..26c7e42 100644
--- a/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm
@@ -105,7 +105,7 @@ Shutdown of Forked JVM
 
 * Shutdown of forked JVM after certain timeout
 
-  Using parammeter <<<forkedProcessTimeoutInSeconds>>> forked JVMs
+  Using parameter <<<forkedProcessTimeoutInSeconds>>> forked JVMs
   are killed separately after every individual process elapsed certain
   amount of time and the whole plugin fails with the error message:
 
diff --git a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
index d4af679..df44f63 100644
--- a/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
+++ b/surefire-api/src/main/java/org/apache/maven/surefire/report/ConsoleOutputCapture.java
@@ -19,8 +19,8 @@ package org.apache.maven.surefire.report;
  * under the License.
  */
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.OutputStream;
 import java.io.PrintStream;
 
 import static java.lang.System.setErr;
@@ -31,7 +31,7 @@ import static org.apache.maven.surefire.util.internal.StringUtils.NL;
  * Deals with system.out/err.
  * <br>
  */
-public class ConsoleOutputCapture
+public final class ConsoleOutputCapture
 {
     public static void startCapture( ConsoleOutputReceiver target )
     {
@@ -39,7 +39,7 @@ public class ConsoleOutputCapture
         setErr( new ForwardingPrintStream( false, target ) );
     }
 
-    private static class ForwardingPrintStream
+    private static final class ForwardingPrintStream
         extends PrintStream
     {
         private final boolean isStdout;
@@ -47,7 +47,7 @@ public class ConsoleOutputCapture
 
         ForwardingPrintStream( boolean stdout, ConsoleOutputReceiver target )
         {
-            super( new ByteArrayOutputStream() );
+            super( new NullOutputStream() );
             isStdout = stdout;
             this.target = target;
         }
@@ -70,11 +70,9 @@ public class ConsoleOutputCapture
         @Override
         public void write( int b )
         {
-            byte[] buf = new byte[1];
-            buf[0] = (byte) b;
             try
             {
-                write( buf );
+                write( new byte[] { (byte) b } );
             }
             catch ( IOException e )
             {
@@ -104,4 +102,13 @@ public class ConsoleOutputCapture
         }
     }
 
+    private static final class NullOutputStream
+            extends OutputStream
+    {
+        @Override
+        public void write( int b ) throws IOException
+        {
+
+        }
+    }
 }
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
index 8a21404..bbb3294 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ForkedBooter.java
@@ -213,11 +213,13 @@ public final class ForkedBooter
                                  && !pingMechanism.pluginProcessChecker.isProcessAlive()
                                  && !pingMechanism.pingScheduler.isShutdown() )
                     {
-                        DumpErrorSingleton.getSingleton().dumpText( "Killing self fork JVM. Maven process died." );
+                        DumpErrorSingleton.getSingleton()
+                                .dumpText( "Killing self fork JVM. Maven process died." );
+
                         kill();
                     }
                 }
-                catch ( Exception e )
+                catch ( RuntimeException e )
                 {
                     DumpErrorSingleton.getSingleton()
                             .dumpException( e, "System.exit() or native command error interrupted process checker." );
@@ -276,7 +278,9 @@ public final class ForkedBooter
                     boolean hasPing = pingDone.getAndSet( false );
                     if ( !hasPing )
                     {
-                        DumpErrorSingleton.getSingleton().dumpText( "Killing self fork JVM. PING timeout elapsed." );
+                        DumpErrorSingleton.getSingleton()
+                                .dumpText( "Killing self fork JVM. PING timeout elapsed." );
+
                         kill();
                     }
                 }
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
index e800cfe..9a2de65 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/ProviderFactory.java
@@ -24,6 +24,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
 import org.apache.maven.surefire.providerapi.SurefireProvider;
+import org.apache.maven.surefire.report.ReporterException;
 import org.apache.maven.surefire.suite.RunResult;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
@@ -151,7 +152,7 @@ public class ProviderFactory
 
         @Override
         public RunResult invoke( Object forkTestSet )
-            throws TestSetFailedException, InvocationTargetException
+            throws TestSetFailedException, ReporterException, InvocationTargetException
         {
             ClassLoader current = swapClassLoader( testsClassLoader );
             try
@@ -167,7 +168,6 @@ public class ProviderFactory
                     Thread.currentThread().setContextClassLoader( current );
                 }
             }
-
         }
 
         private ClassLoader swapClassLoader( ClassLoader newClassLoader )
diff --git a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
index 8003ce5..f98df90 100644
--- a/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
+++ b/surefire-booter/src/main/java/org/apache/maven/surefire/booter/StartupConfiguration.java
@@ -98,7 +98,7 @@ public class StartupConfiguration
      * @param strip the String to remove
      * @return the stripped String
      */
-    public static String stripEnd( String str, String strip )
+    private static String stripEnd( String str, String strip )
     {
         if ( str == null )
         {
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 d6b03bd..3e753de 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
@@ -100,7 +100,7 @@ public class HelperAssertions
         return parseReportList( reports );
     }
 
-    public static IntegrationTestSuiteResults parseIntegrationTestResults( File... testDirs )
+    private static IntegrationTestSuiteResults parseIntegrationTestResults( File... testDirs )
     {
         List<ReportTestSuite> reports = extractITReports( testDirs );
         return parseReportList( reports );
@@ -145,7 +145,7 @@ public class HelperAssertions
         }
     }
 
-    public static List<ReportTestSuite> extractITReports( File... testDirs )
+    private static List<ReportTestSuite> extractITReports( File... testDirs )
     {
         List<File> reportsDirs = new ArrayList<File>();
         for ( File testDir : testDirs )
diff --git a/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java b/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java
index d727946..a231d82 100644
--- a/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java
+++ b/surefire-providers/common-junit3/src/main/java/org/apache/maven/surefire/common/junit3/JUnit3TestChecker.java
@@ -20,11 +20,14 @@ package org.apache.maven.surefire.common.junit3;
  */
 
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import org.apache.maven.surefire.NonAbstractClassFilter;
-import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.ScannerFilter;
 
+import static java.lang.reflect.Modifier.isPublic;
+import static java.lang.reflect.Modifier.isStatic;
+import static org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod;
+import static org.apache.maven.surefire.util.ReflectionUtils.tryLoadClass;
+
 /**
  * Missing tests ? This class is basically a subset of the JUnit4TestChecker, which is tested
  * to boredom and back. Unfortunately we don't have any common module between these providers,
@@ -36,17 +39,15 @@ import org.apache.maven.surefire.util.ScannerFilter;
 public class JUnit3TestChecker
     implements ScannerFilter
 {
-    private final Class<?> junitClass;
-
     private static final Class[] EMPTY_CLASS_ARRAY = new Class[0];
 
+    private final Class<?> junitClass;
 
     private final NonAbstractClassFilter nonAbstractClassFilter = new NonAbstractClassFilter();
 
-
     public JUnit3TestChecker( ClassLoader testClassLoader )
     {
-        junitClass = ReflectionUtils.tryLoadClass( testClassLoader, "junit.framework.Test" );
+        junitClass = tryLoadClass( testClassLoader, "junit.framework.Test" );
     }
 
     @Override
@@ -60,14 +61,13 @@ public class JUnit3TestChecker
         return junitClass != null && ( junitClass.isAssignableFrom( testClass ) || isSuiteOnly( testClass ) );
     }
 
-    public boolean isSuiteOnly( Class testClass )
+    private boolean isSuiteOnly( Class testClass )
     {
-        final Method suite = ReflectionUtils.tryGetMethod( testClass, "suite", EMPTY_CLASS_ARRAY );
+        final Method suite = tryGetMethod( testClass, "suite", EMPTY_CLASS_ARRAY );
         if ( suite != null )
         {
-
             final int modifiers = suite.getModifiers();
-            if ( Modifier.isPublic( modifiers ) && Modifier.isStatic( modifiers ) )
+            if ( isPublic( modifiers ) && isStatic( modifiers ) )
             {
                 return junit.framework.Test.class.isAssignableFrom( suite.getReturnType() );
             }
diff --git a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
index 4d589a6..3d28022 100644
--- a/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
+++ b/surefire-providers/surefire-junit3/src/main/java/org/apache/maven/surefire/junit/PojoTestSet.java
@@ -25,11 +25,13 @@ import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.maven.surefire.report.LegacyPojoStackTraceWriter;
-import org.apache.maven.surefire.report.ReportEntry;
 import org.apache.maven.surefire.report.RunListener;
 import org.apache.maven.surefire.report.SimpleReportEntry;
+import org.apache.maven.surefire.report.StackTraceWriter;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 
+import static org.apache.maven.surefire.report.SimpleReportEntry.withException;
+
 /**
  * Executes a JUnit3 test class
  *
@@ -51,7 +53,7 @@ public class PojoTestSet
 
     private Method tearDownMethod;
 
-    public PojoTestSet( Class<?> testClass )
+    public PojoTestSet( final Class<?> testClass )
         throws TestSetFailedException
     {
         if ( testClass == null )
@@ -114,19 +116,12 @@ public class PojoTestSet
             throw new NullPointerException();
         }
 
-        String userFriendlyMethodName = method.getName() + '(';
-
-        if ( args.length != 0 )
-        {
-            userFriendlyMethodName += "Reporter";
-        }
+        final String testClassName = getTestClass().getName();
+        final String methodName = method.getName();
+        final String userFriendlyMethodName = methodName + '(' + ( args.length == 0 ? "" : "Reporter" ) + ')';
+        final String testName = getTestName( userFriendlyMethodName );
 
-        userFriendlyMethodName += ')';
-
-        ReportEntry report =
-            new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ) );
-
-        reportManager.testStarting( report );
+        reportManager.testStarting( new SimpleReportEntry( testClassName, testName ) );
 
         try
         {
@@ -134,12 +129,8 @@ public class PojoTestSet
         }
         catch ( Throwable e )
         {
-            report =
-                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                                 new LegacyPojoStackTraceWriter( testObject.getClass().getName(),
-                                                                                 method.getName(), e ) );
-
-            reportManager.testFailed( report );
+            StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, e );
+            reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
 
             // A return value of true indicates to this class's executeTestMethods
             // method that it should abort and not attempt to execute
@@ -153,32 +144,20 @@ public class PojoTestSet
         try
         {
             method.invoke( testObject, args );
-
-            report = new SimpleReportEntry( testObject.getClass().getName(), getTestName( userFriendlyMethodName ) );
-
-            reportManager.testSucceeded( report );
+            reportManager.testSucceeded( new SimpleReportEntry( testClassName, testName ) );
         }
-        catch ( InvocationTargetException ite )
+        catch ( InvocationTargetException e )
         {
-            Throwable t = ite.getTargetException();
-
-            report =
-                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                                 new LegacyPojoStackTraceWriter( testObject.getClass().getName(),
-                                                                                 method.getName(), t ) );
-
-            reportManager.testFailed( report );
+            Throwable t = e.getTargetException();
+            StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, t );
+            reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
             // Don't return  here, because tearDownFixture should be called even
             // if the test method throws an exception.
         }
         catch ( Throwable t )
         {
-            report =
-                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                                 new LegacyPojoStackTraceWriter( testObject.getClass().getName(),
-                                                                                 method.getName(), t ) );
-
-            reportManager.testFailed( report );
+            StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, t );
+            reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
             // Don't return  here, because tearDownFixture should be called even
             // if the test method throws an exception.
         }
@@ -189,13 +168,9 @@ public class PojoTestSet
         }
         catch ( Throwable t )
         {
+            StackTraceWriter stackTraceWriter = new LegacyPojoStackTraceWriter( testClassName, methodName, t );
             // Treat any exception from tearDownFixture as a failure of the test.
-            report =
-                SimpleReportEntry.withException( testObject.getClass().getName(), getTestName( userFriendlyMethodName ),
-                                                 new LegacyPojoStackTraceWriter( testObject.getClass().getName(),
-                                                                                 method.getName(), t ) );
-
-            reportManager.testFailed( report );
+            reportManager.testFailed( withException( testClassName, testName, stackTraceWriter ) );
 
             // A return value of true indicates to this class's executeTestMethods
             // method that it should abort and not attempt to execute
@@ -293,10 +268,10 @@ public class PojoTestSet
     @Override
     public String getName()
     {
-        return testClass.getName();
+        return getTestClass().getName();
     }
 
-    public Class<?> getTestClass()
+    private Class<?> getTestClass()
     {
         return testClass;
     }
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
index f687c38..d7b73f2 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
@@ -122,7 +122,7 @@ public abstract class ConcurrentRunListener
     public void testExecutionSkippedByUser()
     {
         // cannot guarantee proper call to all listeners
-        reporterManagerThreadLocal.get().testExecutionSkippedByUser();
+        getRunListener().testExecutionSkippedByUser();
     }
 
     @Override
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
index e9897bd..f8d2fb7 100644
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/NonConcurrentRunListener.java
@@ -54,7 +54,7 @@ public class NonConcurrentRunListener
     }
 
     @Override
-    public synchronized void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
+    public void writeTestOutput( byte[] buf, int off, int len, boolean stdout )
     {
         // We can write immediately: no parallelism and a single class.
         ( (ConsoleOutputReceiver) reporter ).writeTestOutput( buf, off, len, stdout );
diff --git a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java
index 22d7eab..4153084 100755
--- a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java
+++ b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/pc/ParallelComputerBuilder.java
@@ -57,7 +57,7 @@ import static org.apache.maven.surefire.junitcore.pc.Type.METHODS;
 import static org.apache.maven.surefire.junitcore.pc.Type.SUITES;
 
 @SuppressWarnings( { "javadoc", "checkstyle:javadoctype" } )
-/**
+/*
  * Executing suites, classes and methods with defined concurrency. In this example the threads which completed
  * the suites and classes can be reused in parallel methods.
  * <pre>
@@ -403,11 +403,8 @@ public final class ParallelComputerBuilder
         private void determineThreadCounts( long suites, long classes, long methods )
             throws TestSetFailedException
         {
-            RunnerCounter counts = null;
-            if ( ParallelComputerBuilder.this.optimize )
-            {
-                counts = new RunnerCounter( suites, classes, methods );
-            }
+            RunnerCounter counts =
+                    ParallelComputerBuilder.this.optimize ? new RunnerCounter( suites, classes, methods ) : null;
             Concurrency concurrency =
                     resolveConcurrency( ParallelComputerBuilder.this.parameters, counts );
             allGroups.put( SUITES, concurrency.suites );

-- 
To stop receiving notification emails like this one, please contact
tibordigana@apache.org.