Top Description Constructors Methods
org.testng.internal.invokers

pack-priv Class TestNgMethodUtils

extends Object
Class Inheritance
Imports
java.util.Collections, .List, .Optional, java.util.function.BiPredicate, org.testng.IClass, .ITestClass, .ITestNGMethod, org.testng.collections.Lists, .Sets, org.testng.internal.ConfigurationMethod, .Utils

Collections of helper methods to help deal with TestNG configuration methods

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static boolean

Returns:

- true if the method depends on other methods and cannot be run independently.
cannotRunMethodIndependently
(ITestNGMethod
- The ITestNGMethod object which is to be tested.
tm
)

private static boolean

Returns:

- true if the method is a configuration method and exists in the list of methods passed.
containsConfigurationMethod
(ITestNGMethod
- A ITestNGMethod object which needs to be checked.
method
,
List<ITestNGMethod>
- A List of ITestNGMethod in which the check needs to be done.
methods
)

A helper method which checks if a given method is a configuration method and is part of list of TestNG methods

private static boolean
private static boolean
private static boolean
pack-priv static ITestNGMethod[]
pack-priv static ITestNGMethod[]
pack-priv static ITestNGMethod[]

Returns:

Only the ITestNGMethods applicable for this testClass
filterMethods
(Object instance, IClass testClass, ITestNGMethod[] methods, BiPredicate<ITestNGMethod, IClass> predicate)

pack-priv static ITestNGMethod[]
pack-priv static ITestNGMethod[]
pack-priv static Object
pack-priv static boolean

Returns:

- true if the method is a configuration method and false if its a test method.
isConfigurationMethod
(ITestNGMethod
- A ITestNGMethod object which needs to be checked.
method
)

A helper method that checks to see if a method is a configuration method or not.

private static boolean

Returns:

- true if the method is a configuration method and false if its a test method.
isConfigurationMethod
(ITestNGMethod
- A ITestNGMethod object which needs to be checked.
method
,
boolean
- true if before/after group configuration annotations are also to be taken into consideration.
includeGroupConfigs
)

A helper method that checks to see if a method is a configuration method or not.

private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

TestNgMethodUtilsback to summary
private TestNgMethodUtils()

Method Detail

cannotRunMethodIndependentlyback to summary
pack-priv static boolean cannotRunMethodIndependently(ITestNGMethod tm)
Parameters
tm:ITestNGMethod

- The ITestNGMethod object which is to be tested.

Returns:boolean

- true if the method depends on other methods and cannot be run independently.

containsConfigurationMethodback to summary
private static boolean containsConfigurationMethod(ITestNGMethod method, 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:ITestNGMethod

- A ITestNGMethod object which needs to be checked.

methods:List<ITestNGMethod>

- A List of ITestNGMethod in which the check needs to be done.

Returns:boolean

- true if the method is a configuration method and exists in the list of methods passed.

doesConfigMethodPassGroupFiltersback to summary
private static boolean doesConfigMethodPassGroupFilters(ConfigurationMethod cm, ITestNGMethod tm)
doesSetupMethodPassFirstTimeFilterback to summary
private static boolean doesSetupMethodPassFirstTimeFilter(ConfigurationMethod cm, ITestNGMethod tm)
doesTeardownMethodPassLastTimeFilterback to summary
private static boolean doesTeardownMethodPassLastTimeFilter(ConfigurationMethod cm, ITestNGMethod tm)
filterAfterTestMethodsback to summary
pack-priv static ITestNGMethod[] filterAfterTestMethods(Object instance, ITestClass testClass, BiPredicate<ITestNGMethod, IClass> predicate)
filterBeforeTestMethodsback to summary
pack-priv static ITestNGMethod[] filterBeforeTestMethods(Object instance, ITestClass testClass, BiPredicate<ITestNGMethod, IClass> predicate)
filterMethodsback to summary
pack-priv static ITestNGMethod[] filterMethods(Object instance, IClass testClass, ITestNGMethod[] methods, BiPredicate<ITestNGMethod, IClass> predicate)
Returns:ITestNGMethod[]

Only the ITestNGMethods applicable for this testClass

filterSetupConfigurationMethodsback to summary
pack-priv static ITestNGMethod[] filterSetupConfigurationMethods(ITestNGMethod tm, ITestNGMethod[] methods)
filterTeardownConfigurationMethodsback to summary
pack-priv static ITestNGMethod[] filterTeardownConfigurationMethods(ITestNGMethod tm, ITestNGMethod[] methods)
getMethodInvocationTokenback to summary
pack-priv static Object getMethodInvocationToken(ITestNGMethod method, Object instance)
isConfigurationMethodback to summary
pack-priv static boolean isConfigurationMethod(ITestNGMethod method)

A helper method that checks to see if a method is a configuration method or not.

Parameters
method:ITestNGMethod

- A ITestNGMethod object which needs to be checked.

Returns:boolean

- true if the method is a configuration method and false if its a test method.

isConfigurationMethodback to summary
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:ITestNGMethod

- A ITestNGMethod object which needs to be checked.

includeGroupConfigs:boolean

- true if before/after group configuration annotations are also to be taken into consideration.

Returns:boolean

- true if the method is a configuration method and false if its a test method.

isSameInstanceback to summary
private static boolean isSameInstance(ITestNGMethod tm, Object instance)