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 2021/03/03 20:27:46 UTC

[maven-surefire] branch master updated: refactoring in TestNG740Configurator.java

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 5814d68  refactoring in TestNG740Configurator.java
5814d68 is described below

commit 5814d68df5b5e2fc05da3f01fa943099736d3ece
Author: tibordigana <ti...@gmail.com>
AuthorDate: Wed Mar 3 21:27:37 2021 +0100

    refactoring in TestNG740Configurator.java
---
 .../maven/surefire/testng/conf/TestNG740Configurator.java      | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG740Configurator.java b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG740Configurator.java
index 5d4f028..f68cf2b 100644
--- a/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG740Configurator.java
+++ b/surefire-providers/surefire-testng/src/main/java/org/apache/maven/surefire/testng/conf/TestNG740Configurator.java
@@ -20,7 +20,6 @@ package org.apache.maven.surefire.testng.conf;
  */
 
 import org.apache.maven.surefire.api.testset.TestSetFailedException;
-import org.apache.maven.surefire.api.util.ReflectionUtils;
 import org.testng.xml.XmlSuite;
 
 import java.util.Map;
@@ -28,6 +27,8 @@ import java.util.Map;
 import static java.lang.Integer.parseInt;
 import static org.apache.maven.surefire.api.booter.ProviderParameterNames.PARALLEL_PROP;
 import static org.apache.maven.surefire.api.booter.ProviderParameterNames.THREADCOUNT_PROP;
+import static org.apache.maven.surefire.api.util.ReflectionUtils.invokeSetter;
+import static org.apache.maven.surefire.api.util.ReflectionUtils.tryLoadClass;
 
 /**
  * TestNG 7.4.0 configurator. Changed setParallel type to enum value.
@@ -54,10 +55,9 @@ public class TestNG740Configurator extends TestNG60Configurator
                 throw new TestSetFailedException( "Unsupported TestNG parallel setting: "
                     + parallel + " ( only METHODS or CLASSES supported )" );
             }
-            Class enumClass = ReflectionUtils.tryLoadClass( XmlSuite.class.getClassLoader(),
-                "org.testng.xml.XmlSuite$ParallelMode" );
-            Object parallelEnum = Enum.valueOf( enumClass, parallel.toUpperCase() );
-            ReflectionUtils.invokeSetter( suite, "setParallel", enumClass, parallelEnum );
+            Class enumClass = tryLoadClass( XmlSuite.class.getClassLoader(), "org.testng.xml.XmlSuite$ParallelMode" );
+            Enum<?> parallelEnum = Enum.valueOf( enumClass, parallel.toUpperCase() );
+            invokeSetter( suite, "setParallel", enumClass, parallelEnum );
         }
 
         String dataProviderThreadCount = options.get( "dataproviderthreadcount" );