Package org.testng.internal
Class Parameters
- java.lang.Object
-
- org.testng.internal.Parameters
-
public class Parameters extends Object
Methods that bind parameters declared in testng.xml to actual values used to invoke methods.- Author:
- Cedric Beust
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Parameters.MethodParameters
A parameter passing helper class.
-
Field Summary
Fields Modifier and Type Field Description static String
NULL_VALUE
-
Constructor Summary
Constructors Constructor Description Parameters()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> T
convertType(Class<T> type, String value, String paramName)
static Object[]
createConfigurationParameters(Method m, Map<String,String> params, Object[] parameterValues, ITestNGMethod currentTestMethod, IAnnotationFinder finder, XmlSuite xmlSuite, ITestContext ctx, ITestResult testResult)
Creates the parameters needed for the specified @ConfigurationMethod
.static Object[]
createInstantiationParameters(Constructor ctor, String methodAnnotation, IAnnotationFinder finder, String[] parameterNames, Map<String,String> params, XmlSuite xmlSuite)
Creates the parameters needed for constructing a test class instance.static Object
getInjectedParameter(Class<?> c, Method method, ITestContext context, ITestResult testResult)
Deprecated.- This method stands deprecated as of TestNG v6.11.static Object[]
getParametersFromIndex(Iterator<Object[]> parametersValues, int index)
static ParameterHolder
handleParameters(ITestNGMethod testMethod, Map<String,String> allParameterNames, Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, Object fedInstance)
If the method has parameters, fill them in.static ParameterHolder
handleParameters(ITestNGMethod testMethod, Map<String,String> allParameterNames, Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, Object fedInstance, Collection<IDataProviderListener> dataProviderListeners)
If the method has parameters, fill them in.static Object[]
injectParameters(Object[] parameterValues, Method method, ITestContext context)
Gets an array of parameter values returned by data provider or the ones that are injected based on parameter type.
-
-
-
Field Detail
-
NULL_VALUE
public static final String NULL_VALUE
- See Also:
- Constant Field Values
-
-
Method Detail
-
createInstantiationParameters
public static Object[] createInstantiationParameters(Constructor ctor, String methodAnnotation, IAnnotationFinder finder, String[] parameterNames, Map<String,String> params, XmlSuite xmlSuite)
Creates the parameters needed for constructing a test class instance.- Parameters:
finder
- TODO
-
createConfigurationParameters
public static Object[] createConfigurationParameters(Method m, Map<String,String> params, Object[] parameterValues, @Nullable ITestNGMethod currentTestMethod, IAnnotationFinder finder, XmlSuite xmlSuite, ITestContext ctx, ITestResult testResult)
Creates the parameters needed for the specified @ConfigurationMethod
.- Parameters:
m
- the configuraton methodcurrentTestMethod
- the current @Test method ornull
if no @Test is available (this is not only in case the configuration method is a @Before/@AfterMethodfinder
- the annotation finder
-
getInjectedParameter
@Deprecated public static Object getInjectedParameter(Class<?> c, Method method, ITestContext context, ITestResult testResult)
Deprecated.- This method stands deprecated as of TestNG v6.11. There are no alternatives.
-
handleParameters
public static ParameterHolder handleParameters(ITestNGMethod testMethod, Map<String,String> allParameterNames, Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, Object fedInstance)
If the method has parameters, fill them in. Either by using a @DataProvider if any was provided, or by looking upin testng.xml - Returns:
- An Iterator over the values for each parameter of this method.
-
handleParameters
public static ParameterHolder handleParameters(ITestNGMethod testMethod, Map<String,String> allParameterNames, Object instance, Parameters.MethodParameters methodParams, XmlSuite xmlSuite, IAnnotationFinder annotationFinder, Object fedInstance, Collection<IDataProviderListener> dataProviderListeners)
If the method has parameters, fill them in. Either by using a @DataProvider if any was provided, or by looking upin testng.xml - Returns:
- An Iterator over the values for each parameter of this method.
-
injectParameters
public static Object[] injectParameters(Object[] parameterValues, Method method, ITestContext context) throws TestNGException
Gets an array of parameter values returned by data provider or the ones that are injected based on parameter type. The method also checks forNoInjection
annotation- Parameters:
parameterValues
- parameter values from a data providermethod
- method to be invokedcontext
- test context- Throws:
TestNGException
-
-