maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1056679 - in /maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4: JUnit4Provider.java JUnit4TestSetReporter.java
Date Sat, 08 Jan 2011 09:56:07 GMT
Author: krosenvold
Date: Sat Jan  8 09:56:06 2011
New Revision: 1056679

URL: http://svn.apache.org/viewvc?rev=1056679&view=rev
Log:
o Cleaned junit4 provider

Modified:
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
    maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java?rev=1056679&r1=1056678&r2=1056679&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4Provider.java
Sat Jan  8 09:56:06 2011
@@ -86,14 +86,13 @@ public class JUnit4Provider
 
         upgradeCheck();
 
-        JUnit4TestSetReporter jUnit4TestSetReporter = new JUnit4TestSetReporter( null, null
);
-
+        ReporterManager reporter = (ReporterManager) reporterFactory.createReporter();
+        JUnit4TestSetReporter jUnit4TestSetReporter = new JUnit4TestSetReporter( null, reporter
);
         RunNotifier runNotifer = getRunNotifer( jUnit4TestSetReporter, customRunListeners
);
+
         for ( Class clazz : testsToRun.getLocatedClasses() )
         {
-            ReporterManager reporter = (ReporterManager) reporterFactory.createReporter();
             jUnit4TestSetReporter.setTestSet( clazz );
-            jUnit4TestSetReporter.setReportMgr( reporter );
             executeTestSet( clazz, reporter, testClassLoader, runNotifer );
         }
 
@@ -103,6 +102,20 @@ public class JUnit4Provider
 
     }
 
+    private void executeTestSet( Class clazz, ReporterManager reporter, ClassLoader classLoader,
RunNotifier listeners )
+        throws ReporterException, TestSetFailedException
+    {
+        final ReportEntry report = new SimpleReportEntry( this.getClass().getName(), clazz.getName()
);
+
+        reporter.testSetStarting( report );
+
+        JUnit4TestSet.execute( clazz, listeners );
+
+        reporter.testSetCompleted( report );
+
+        reporter.reset();
+    }
+
     private RunNotifier getRunNotifer( RunListener main, List<RunListener> others )
     {
         RunNotifier fNotifier = new RunNotifier();
@@ -116,7 +129,6 @@ public class JUnit4Provider
 
     // I am not entierly sure as to why we do this explicit freeing, it's one of those
     // pieces of code that just seem to linger on in here ;)
-
     private void closeRunNotifer( RunListener main, List<RunListener> others )
     {
         RunNotifier fNotifier = new RunNotifier();
@@ -133,25 +145,6 @@ public class JUnit4Provider
         return testsToRun.iterator();
     }
 
-    private void executeTestSet( Class clazz, ReporterManager reporter, ClassLoader classLoader,
RunNotifier listeners )
-        throws ReporterException, TestSetFailedException
-    {
-
-        ReportEntry report = new SimpleReportEntry( this.getClass().getName(), clazz.getName()
);
-
-        reporter.testSetStarting( report );
-
-        JUnit4TestSet.execute( clazz, listeners );
-
-        report = new SimpleReportEntry( this.getClass().getName(), clazz.getName() );
-
-        reporter.testSetCompleted( report );
-
-        reporter.reset();
-
-    }
-
-
     private TestsToRun scanClassPath()
     {
         return directoryScanner.locateTestClasses( testClassLoader, jUnit4TestChecker );

Modified: maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java?rev=1056679&r1=1056678&r2=1056679&view=diff
==============================================================================
--- maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
(original)
+++ maven/surefire/trunk/surefire-providers/surefire-junit4/src/main/java/org/apache/maven/surefire/junit4/JUnit4TestSetReporter.java
Sat Jan  8 09:56:06 2011
@@ -33,6 +33,11 @@ import java.util.regex.Pattern;
 public class JUnit4TestSetReporter
     extends RunListener
 {
+    private static final Pattern PARENS = Pattern.compile( "^" + "[^\\(\\)]+" //non-parens
+                                                + "\\((" // then an open-paren (start matching
a group)
+                                                + "[^\\\\(\\\\)]+" //non-parens
+                                                + ")\\)" + "$" ); // then a close-paren (end
group match)
+
     // Member Variables
     private Class testSet;
 
@@ -156,10 +161,6 @@ public class JUnit4TestSetReporter
     private String extractClassName( Description description )
     {
         String displayName = description.getDisplayName();
-        final Pattern PARENS = Pattern.compile( "^" + "[^\\(\\)]+" //non-parens
-                                                    + "\\((" // then an open-paren (start
matching a group)
-                                                    + "[^\\\\(\\\\)]+" //non-parens
-                                                    + ")\\)" + "$" ); // then a close-paren
(end group match)
         Matcher m = PARENS.matcher( displayName );
         if ( !m.find() )
         {



Mime
View raw message