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 e23253e5 [SUREFIRE-1762] skipAfterFailureCount>0 with testng 7.1.0 
resulting in java.lang.NoSuchMethodError: 
org.testng.TestNG.addListener(Lorg/testng/ITestListener;)V
e23253e5 is described below

commit e23253e555e8c9844abd99e2d51968386c9ead24
Author: lne3 <lutz.neugeba...@asg.com>
AuthorDate: Tue Mar 24 11:29:13 2020 +0100

    [SUREFIRE-1762] skipAfterFailureCount>0 with testng 7.1.0 resulting in 
java.lang.NoSuchMethodError: 
org.testng.TestNG.addListener(Lorg/testng/ITestListener;)V
    
    * instead of org.testng.TestNG.addListener(org.testng.ITestListener) which
      has been removed from testng 7.x+ (SUREFIRE-1762)
    * instead of org.testng.TestNG.addListener(java.lang.Object) which is
      deprecated in testng 7.x+
---
 .../java/org/apache/maven/surefire/testng/TestNGExecutor.java    | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
index 19ad157..85d67df 100644
--- 
a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
+++ 
b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/TestNGExecutor.java
@@ -29,6 +29,7 @@ import org.apache.maven.surefire.testng.utils.Stoppable;
 import org.apache.maven.surefire.testset.TestListResolver;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.apache.maven.surefire.shared.utils.StringUtils;
+import org.testng.ITestNGListener;
 import org.testng.TestNG;
 import org.testng.annotations.Test;
 import org.testng.xml.XmlClass;
@@ -302,14 +303,16 @@ final class TestNGExecutor
         testNG.setVerbose( verboseLevel );
 
         TestNGReporter reporter = createTestNGReporter( reportManager );
-        testNG.addListener( (Object) reporter );
+        testNG.addListener( (ITestNGListener) reporter );
 
         if ( skipAfterFailureCount > 0 )
         {
             ClassLoader cl = Thread.currentThread().getContextClassLoader();
-            testNG.addListener( instantiate( cl, 
"org.apache.maven.surefire.testng.utils.FailFastNotifier",
+            testNG.addListener( (ITestNGListener)
+                                instantiate( cl, 
"org.apache.maven.surefire.testng.utils.FailFastNotifier",
                                              Object.class ) );
-            testNG.addListener( new FailFastListener( createStoppable( 
reportManager, skipAfterFailureCount ) ) );
+            testNG.addListener( (ITestNGListener)
+                                new FailFastListener( createStoppable( 
reportManager, skipAfterFailureCount ) ) );
         }
 
         // FIXME: use classifier to decide if we need to pass along the source 
dir (only for JDK14)

Reply via email to