Top Description Fields Constructors Methods
org.testng.internal

public Class MethodGroupsHelper

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, java.util.Arrays, .Collection, .List, .Map, .Set, java.util.concurrent.ConcurrentHashMap, java.util.function.Predicate, java.util.regex.Pattern, java.util.stream.Collectors, .Stream, org.testng.ITestClass, .ITestNGMethod, org.testng.annotations.IConfigurationAnnotation, .ITestOrConfiguration, org.testng.collections.Lists, .Maps, org.testng.internal.annotations.AnnotationHelper, .IAnnotationFinder, org.testng.internal.collections.Pair

Collections of helper methods to help deal with test methods

Field Summary

Modifier and TypeField and Description
private static final Map<Pair<String, String>, Boolean>
private static final Map<String, Pattern>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
collectMethodsByGroup(ITestNGMethod[] methods, boolean forTests, List<ITestNGMethod> outIncludedMethods, List<ITestNGMethod> outExcludedMethods, RunInfo runInfo, IAnnotationFinder finder, boolean unique)

Collect all the methods that belong to the included groups and exclude all the methods that belong to an excluded group.

public static Map<String, List<ITestNGMethod>>

Returns:

the map of groups and their corresponding methods from the extraction of classes .
findGroupsMethods
(Collection<ITestClass> classes, boolean before)

protected static void
findGroupTransitiveClosure(List<ITestNGMethod> includedMethods, List<ITestNGMethod> allMethods, String[] includedGroups, Set<String> outGroups, Set<ITestNGMethod> outMethods)

private static ITestNGMethod
public static ITestNGMethod[]

Returns:

all the methods that belong to the group specified by the regular expression groupRegExp. methods[] is the list of all the methods we are choosing from and method is the method that owns the dependsOnGroups statement (only used if a group is missing to flag an error on that method).
findMethodsThatBelongToGroup
(ITestNGMethod
if no group is found, group regex is set as this method's missing group
method
,
ITestNGMethod[]
list of methods to search
methods
,
String
regex representing the group
groupRegexp
)

Only used if a group is missing to flag an error on that method

protected static ITestNGMethod[]

Returns:

all the methods that belong to the group specified by the regular expression groupRegExp. methods[] is the list of all the methods we are choosing from.
findMethodsThatBelongToGroup
(ITestNGMethod[]
list of methods to search
methods
,
String
regex representing the group
groupRegexp
)

private static Pattern
getPattern(String groupRegexp)

private static boolean
includeMethod(ITestOrConfiguration annotation, RunInfo runInfo, ITestNGMethod tm, boolean forTests, boolean unique, List<ITestNGMethod> outIncludedMethods)

private static Boolean
isMatch(Pattern pattern, String group)

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

Field Detail

MATCH_CACHEback to summary
private static final Map<Pair<String, String>, Boolean> MATCH_CACHE
PATTERN_CACHEback to summary
private static final Map<String, Pattern> PATTERN_CACHE

Constructor Detail

MethodGroupsHelperback to summary
public MethodGroupsHelper()

Method Detail

collectMethodsByGroupback to summary
pack-priv static void collectMethodsByGroup(ITestNGMethod[] methods, boolean forTests, List<ITestNGMethod> outIncludedMethods, List<ITestNGMethod> outExcludedMethods, RunInfo runInfo, IAnnotationFinder finder, boolean unique)

Collect all the methods that belong to the included groups and exclude all the methods that belong to an excluded group.

findGroupsMethodsback to summary
public static Map<String, List<ITestNGMethod>> findGroupsMethods(Collection<ITestClass> classes, boolean before)
Returns:Map<String, List<ITestNGMethod>>

the map of groups and their corresponding methods from the extraction of classes .

findGroupTransitiveClosureback to summary
protected static void findGroupTransitiveClosure(List<ITestNGMethod> includedMethods, List<ITestNGMethod> allMethods, String[] includedGroups, Set<String> outGroups, Set<ITestNGMethod> outMethods)
findMethodNamedback to summary
private static ITestNGMethod findMethodNamed(String tm, List<ITestNGMethod> allMethods)
findMethodsThatBelongToGroupback to summary
public static ITestNGMethod[] findMethodsThatBelongToGroup(ITestNGMethod method, ITestNGMethod[] methods, String groupRegexp)

Only used if a group is missing to flag an error on that method

Parameters
method:ITestNGMethod

if no group is found, group regex is set as this method's missing group

methods:ITestNGMethod[]

list of methods to search

groupRegexp:String

regex representing the group

Returns:ITestNGMethod[]

all the methods that belong to the group specified by the regular expression groupRegExp. methods[] is the list of all the methods we are choosing from and method is the method that owns the dependsOnGroups statement (only used if a group is missing to flag an error on that method).

findMethodsThatBelongToGroupback to summary
protected static ITestNGMethod[] findMethodsThatBelongToGroup(ITestNGMethod[] methods, String groupRegexp)
Parameters
methods:ITestNGMethod[]

list of methods to search

groupRegexp:String

regex representing the group

Returns:ITestNGMethod[]

all the methods that belong to the group specified by the regular expression groupRegExp. methods[] is the list of all the methods we are choosing from.

getPatternback to summary
private static Pattern getPattern(String groupRegexp)
includeMethodback to summary
private static boolean includeMethod(ITestOrConfiguration annotation, RunInfo runInfo, ITestNGMethod tm, boolean forTests, boolean unique, List<ITestNGMethod> outIncludedMethods)
isMatchback to summary
private static Boolean isMatch(Pattern pattern, String group)
isMethodAlreadyNotPresentback to summary
private static boolean isMethodAlreadyNotPresent(List<ITestNGMethod> result, ITestNGMethod tm)