Package org.testng.internal
Class TestNgMethodUtils
- java.lang.Object
-
- org.testng.internal.TestNgMethodUtils
-
class TestNgMethodUtils extends java.lang.ObjectCollections of helper methods to help deal with TestNG configuration methods
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTestNgMethodUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static booleancannotRunMethodIndependently(ITestNGMethod tm)private static booleancontainsConfigurationMethod(ITestNGMethod method, java.util.List<ITestNGMethod> methods)A helper method which checks if a given method is a configuration method and is part of list of TestNG methods(package private) static ITestNGMethod[]filterAfterTestMethods(ITestClass testClass, Invoker.Predicate<ITestNGMethod,IClass> predicate)(package private) static ITestNGMethod[]filterBeforeTestMethods(ITestClass testClass, Invoker.Predicate<ITestNGMethod,IClass> predicate)(package private) static ITestNGMethod[]filterFirstTimeRunnableSetupConfigurationMethods(ITestNGMethod tm, ITestNGMethod[] methods)The array of methods contains @BeforeMethods if isBefore if true, @AfterMethods otherwise.(package private) static ITestNGMethod[]filterLastTimeRunnableTeardownConfigurationMethods(ITestNGMethod tm, ITestNGMethod[] methods)(package private) static ITestNGMethod[]filterMethods(IClass testClass, ITestNGMethod[] methods, Invoker.Predicate<ITestNGMethod,IClass> predicate)(package private) static java.lang.ObjectgetMethodInvocationToken(ITestNGMethod method, java.lang.Object instance)private static booleanisConfigMethodRunningFirstTime(ConfigurationMethod cm, ITestNGMethod tm)private static booleanisConfigMethodRunningLastTime(ConfigurationMethod cm, ITestNGMethod tm)(package private) static booleanisConfigurationMethod(ITestNGMethod method)A helper method that checks to see if a method is a configuration method or not.private static booleanisConfigurationMethod(ITestNGMethod method, boolean includeGroupConfigs)A helper method that checks to see if a method is a configuration method or not.
-
-
-
Method Detail
-
isConfigurationMethod
static boolean isConfigurationMethod(ITestNGMethod method)
A helper method that checks to see if a method is a configuration method or not.- Parameters:
method- - AITestNGMethodobject which needs to be checked.- Returns:
- -
trueif the method is a configuration method and false if its a test method.
-
isConfigurationMethod
private static boolean isConfigurationMethod(ITestNGMethod method, boolean includeGroupConfigs)
A helper method that checks to see if a method is a configuration method or not.- Parameters:
method- - AITestNGMethodobject which needs to be checked.includeGroupConfigs- -trueif before/after group configuration annotations are also to be taken into consideration.- Returns:
- -
trueif the method is a configuration method and false if its a test method.
-
containsConfigurationMethod
private static boolean containsConfigurationMethod(ITestNGMethod method, java.util.List<ITestNGMethod> methods)
A helper method which checks if a given method is a configuration method and is part of list of TestNG methods- Parameters:
method- - AITestNGMethodobject which needs to be checked.methods- - A List ofITestNGMethodin which the check needs to be done.- Returns:
- -
trueif the method is a configuration method and exists in the list of methods passed.
-
filterBeforeTestMethods
static ITestNGMethod[] filterBeforeTestMethods(ITestClass testClass, Invoker.Predicate<ITestNGMethod,IClass> predicate)
-
filterAfterTestMethods
static ITestNGMethod[] filterAfterTestMethods(ITestClass testClass, Invoker.Predicate<ITestNGMethod,IClass> predicate)
-
filterMethods
static ITestNGMethod[] filterMethods(IClass testClass, ITestNGMethod[] methods, Invoker.Predicate<ITestNGMethod,IClass> predicate)
- Returns:
- Only the ITestNGMethods applicable for this testClass
-
filterFirstTimeRunnableSetupConfigurationMethods
static ITestNGMethod[] filterFirstTimeRunnableSetupConfigurationMethods(ITestNGMethod tm, ITestNGMethod[] methods)
The array of methods contains @BeforeMethods if isBefore if true, @AfterMethods otherwise. This function removes all the methods that should not be run at this point because they are either firstTimeOnly or lastTimeOnly and we haven't reached the current invocationCount yet
-
filterLastTimeRunnableTeardownConfigurationMethods
static ITestNGMethod[] filterLastTimeRunnableTeardownConfigurationMethods(ITestNGMethod tm, ITestNGMethod[] methods)
-
cannotRunMethodIndependently
static boolean cannotRunMethodIndependently(ITestNGMethod tm)
- Parameters:
tm- - TheITestNGMethodobject which is to be tested.- Returns:
- -
trueif the method depends on other methods and cannot be run independently.
-
getMethodInvocationToken
static java.lang.Object getMethodInvocationToken(ITestNGMethod method, java.lang.Object instance)
-
isConfigMethodRunningFirstTime
private static boolean isConfigMethodRunningFirstTime(ConfigurationMethod cm, ITestNGMethod tm)
-
isConfigMethodRunningLastTime
private static boolean isConfigMethodRunningLastTime(ConfigurationMethod cm, ITestNGMethod tm)
-
-