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 2020/10/23 23:35:20 UTC
[maven-surefire] branch master updated: TestNGExecutor refactoring
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 8ad2d73 TestNGExecutor refactoring
8ad2d73 is described below
commit 8ad2d7309b53bb55bfdc473ce08ac73ed5f584d7
Author: tibordigana <ti...@gmail.com>
AuthorDate: Sat Oct 24 01:35:04 2020 +0200
TestNGExecutor refactoring
---
.../apache/maven/surefire/testng/TestNGExecutor.java | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 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 271e8bf..56fc9d5 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
@@ -25,6 +25,7 @@ import org.apache.maven.surefire.api.report.RunListener;
import org.apache.maven.surefire.testng.conf.Configurator;
import org.apache.maven.surefire.testng.utils.FailFastEventsSingleton;
import org.apache.maven.surefire.testng.utils.FailFastListener;
+import org.apache.maven.surefire.testng.utils.FailFastNotifier;
import org.apache.maven.surefire.testng.utils.Stoppable;
import org.apache.maven.surefire.api.testset.TestListResolver;
import org.apache.maven.surefire.api.testset.TestSetFailedException;
@@ -188,9 +189,9 @@ final class TestNGExecutor
private static class SuiteAndNamedTests
{
- private XmlSuite xmlSuite = new XmlSuite();
+ private final XmlSuite xmlSuite = new XmlSuite();
- private Map<String, XmlTest> testNameToTest = new HashMap<>();
+ private final Map<String, XmlTest> testNameToTest = new HashMap<>();
}
private static void addSelector( XmlTest xmlTest, XmlMethodSelector selector )
@@ -307,12 +308,9 @@ final class TestNGExecutor
if ( skipAfterFailureCount > 0 )
{
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- testNG.addListener( (ITestNGListener)
- instantiate( cl, "org.apache.maven.surefire.testng.utils.FailFastNotifier",
- Object.class ) );
- testNG.addListener( (ITestNGListener)
- new FailFastListener( createStoppable( reportManager, skipAfterFailureCount ) ) );
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ testNG.addListener( instantiate( classLoader, FailFastNotifier.class.getName(), Object.class ) );
+ testNG.addListener( new FailFastListener( createStoppable( reportManager, skipAfterFailureCount ) ) );
}
// FIXME: use classifier to decide if we need to pass along the source dir (only for JDK14)
@@ -350,8 +348,8 @@ final class TestNGExecutor
try
{
Class.forName( "org.testng.internal.IResultListener" );
- Class c = Class.forName( "org.apache.maven.surefire.testng.ConfigurationAwareTestNGReporter" );
- @SuppressWarnings( "unchecked" ) Constructor<?> ctor = c.getConstructor( RunListener.class );
+ Class<?> c = Class.forName( "org.apache.maven.surefire.testng.ConfigurationAwareTestNGReporter" );
+ Constructor<?> ctor = c.getConstructor( RunListener.class );
return (TestNGReporter) ctor.newInstance( reportManager );
}
catch ( InvocationTargetException e )