You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/02/12 22:59:37 UTC

[GitHub] [maven-surefire] slawekjaranowski commented on a change in pull request #469: [SUREFIRE-2011] Updated abstractions which helps associating standard out/err with a test

slawekjaranowski commented on a change in pull request #469:
URL: https://github.com/apache/maven-surefire/pull/469#discussion_r805212066



##########
File path: surefire-api/src/main/java/org/apache/maven/surefire/api/report/ReporterFactory.java
##########
@@ -33,7 +33,7 @@
      *
      * @return A reporter instance
      */
-    RunListener createReporter();
+    TestRunListener createReporter();

Review comment:
       rename method `createReporter` -> `crateTestRunListener` WDYT?
   
   javadoc for this method is still actual?

##########
File path: surefire-providers/common-junit4/src/main/java/org/apache/maven/surefire/common/junit4/JUnit4RunListener.java
##########
@@ -41,12 +43,14 @@
  *
  */
 public class JUnit4RunListener
-    extends org.junit.runner.notification.RunListener
+    extends RunListener
+    implements TestOutputReceiver
 {
-    protected final RunListener reporter;
+    protected final TestRunListener reporter;

Review comment:
       maybe also change reported -> testRunListener
   and in other similar place

##########
File path: surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/ConcurrentRunListener.java
##########
@@ -61,10 +60,10 @@
         this.reportImmediately = reportImmediately;
         this.classMethodCounts = classMethodCounts;
         this.consoleStream = consoleStream;
-        reporterManagerThreadLocal = new ThreadLocal<RunListener>()
+        reporterManagerThreadLocal = new ThreadLocal<TestRunListener>()
         {
             @Override
-            protected RunListener initialValue()
+            protected TestRunListener initialValue()
             {
                 return reporterFactory.createReporter();
             }

Review comment:
       now can be like:
   ```
    reporterManagerThreadLocal = ThreadLocal.withInitial( reporterFactory::createReporter );
   
   ```
   
   TestSetFailedException is not thrown from this constructor - line 58

##########
File path: maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/TestSetRunListener.java
##########
@@ -51,13 +50,13 @@
  * @author Kristian Rosenvold
  */
 public class TestSetRunListener
-    implements RunListener, ConsoleOutputReceiver, ConsoleLogger
+    implements TestRunListener, ConsoleLogger

Review comment:
       still we need implements `ConsoleLogger`?
   class `TestSetRunListener` is created in one place in `DefaultReporterFactory#createReporter` as  `TestRunListener` ...

##########
File path: surefire-api/src/main/java/org/apache/maven/surefire/api/report/TestRunListener.java
##########
@@ -0,0 +1,28 @@
+package org.apache.maven.surefire.api.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.
+ */
+
+/**
+ *
+ */
+public interface TestRunListener
+    extends RunListener, TestOutputReceiver
+{
+}

Review comment:
       New interface -  it will be good to add javadoc with description what purpose of this interface is.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org