public class MethodHelper
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
MethodHelper.MatchResults |
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.reflect.Method,java.lang.String> |
CANONICAL_NAME_CACHE |
private static java.util.Map<ITestNGMethod[],Graph<ITestNGMethod>> |
GRAPH_CACHE |
private static java.util.Map<Pair<java.lang.String,java.lang.String>,java.lang.Boolean> |
MATCH_CACHE |
Constructor and Description |
---|
MethodHelper() |
Modifier and Type | Method and Description |
---|---|
protected static java.lang.String |
calculateMethodCanonicalName(java.lang.Class<?> methodClass,
java.lang.String methodName) |
protected static java.lang.String |
calculateMethodCanonicalName(ITestNGMethod m) |
private static java.lang.String |
calculateMethodCanonicalName(java.lang.reflect.Method m) |
protected static long |
calculateTimeOut(ITestNGMethod tm) |
static ITestNGMethod[] |
collectAndOrderMethods(java.util.List<ITestNGMethod> methods,
boolean forTests,
RunInfo runInfo,
IAnnotationFinder finder,
boolean unique,
java.util.List<ITestNGMethod> outExcludedMethods,
java.util.Comparator<ITestNGMethod> comparator)
Collects and orders test or configuration methods
|
static void |
dumpInvokedMethodsInfoToConsole(java.util.Collection<IInvokedMethod> iInvokedMethods,
int currentVerbosity) |
protected static ITestNGMethod[] |
findDependedUponMethods(ITestNGMethod m,
ITestNGMethod[] methods)
Finds TestNG methods that the specified TestNG method depends upon
|
protected static ITestNGMethod[] |
findDependedUponMethods(ITestNGMethod m,
java.util.List<ITestNGMethod> methods)
Finds TestNG methods that the specified TestNG method depends upon
|
private static java.lang.reflect.Method |
findMethodByName(ITestNGMethod testngMethod,
java.lang.String regExp)
Finds method based on regex and TestNGMethod.
|
static void |
fixMethodsWithClass(ITestNGMethod[] methods,
ITestClass testCls,
java.util.List<ITestNGMethod> methodList) |
static java.util.List<ITestNGMethod> |
getMethodsDependedUpon(ITestNGMethod method,
ITestNGMethod[] methods,
java.util.Comparator<ITestNGMethod> comparator) |
static java.util.List<ITestNGMethod> |
invokedMethodsToMethods(java.util.Collection<IInvokedMethod> invokedMethods) |
(package private) static boolean |
isAlwaysRun(IConfigurationAnnotation configurationAnnotation) |
(package private) static boolean |
isDisabled(ITestOrConfiguration test) |
protected static boolean |
isEnabled(java.lang.Class<?> objectClass,
IAnnotationFinder finder) |
protected static boolean |
isEnabled(ITestOrConfiguration test) |
protected static boolean |
isEnabled(java.lang.reflect.Method m,
IAnnotationFinder finder) |
private static MethodHelper.MatchResults |
matchMethod(ITestNGMethod[] methods,
java.lang.String regexp) |
static java.util.List<ITestNGMethod> |
methodInstancesToMethods(java.util.List<IMethodInstance> methodInstances) |
static java.util.List<IMethodInstance> |
methodsToMethodInstances(java.util.List<ITestNGMethod> sl) |
private static java.util.List<ITestNGMethod> |
sortMethods(boolean forTests,
java.util.List<ITestNGMethod> allMethods,
java.util.Comparator<ITestNGMethod> comparator) |
private static java.util.Map<java.lang.Object,java.util.List<ITestNGMethod>> |
sortMethodsByInstance(ITestNGMethod[] methods)
This method is used to create a map of test instances and their associated
method(s) .
|
private static Graph<ITestNGMethod> |
topologicalSort(ITestNGMethod[] methods,
java.util.List<ITestNGMethod> sequentialList,
java.util.List<ITestNGMethod> parallelList,
java.util.Comparator<ITestNGMethod> comparator) |
static java.util.List<ITestNGMethod> |
uniqueMethodList(java.util.Collection<java.util.List<ITestNGMethod>> methods)
Extracts the unique list of
ITestNGMethod s. |
private static final java.util.Map<ITestNGMethod[],Graph<ITestNGMethod>> GRAPH_CACHE
private static final java.util.Map<java.lang.reflect.Method,java.lang.String> CANONICAL_NAME_CACHE
private static final java.util.Map<Pair<java.lang.String,java.lang.String>,java.lang.Boolean> MATCH_CACHE
public static ITestNGMethod[] collectAndOrderMethods(java.util.List<ITestNGMethod> methods, boolean forTests, RunInfo runInfo, IAnnotationFinder finder, boolean unique, java.util.List<ITestNGMethod> outExcludedMethods, java.util.Comparator<ITestNGMethod> comparator)
methods
- methods to be worked onforTests
- true for test methods, false for configuration methodsrunInfo
- finder
- annotation finderunique
- true for unique methods, false otherwiseoutExcludedMethods
- protected static ITestNGMethod[] findDependedUponMethods(ITestNGMethod m, java.util.List<ITestNGMethod> methods)
m
- TestNG methodmethods
- list of methods to search for depended upon methodsprotected static ITestNGMethod[] findDependedUponMethods(ITestNGMethod m, ITestNGMethod[] methods)
m
- TestNG methodmethods
- list of methods to search for depended upon methodsprivate static java.lang.reflect.Method findMethodByName(ITestNGMethod testngMethod, java.lang.String regExp)
testngMethod
- TestNG methodregExp
- regex representing a method and/or related class nameprotected static boolean isEnabled(java.lang.Class<?> objectClass, IAnnotationFinder finder)
protected static boolean isEnabled(java.lang.reflect.Method m, IAnnotationFinder finder)
protected static boolean isEnabled(ITestOrConfiguration test)
static boolean isDisabled(ITestOrConfiguration test)
static boolean isAlwaysRun(IConfigurationAnnotation configurationAnnotation)
public static java.util.List<ITestNGMethod> uniqueMethodList(java.util.Collection<java.util.List<ITestNGMethod>> methods)
ITestNGMethod
s.private static Graph<ITestNGMethod> topologicalSort(ITestNGMethod[] methods, java.util.List<ITestNGMethod> sequentialList, java.util.List<ITestNGMethod> parallelList, java.util.Comparator<ITestNGMethod> comparator)
private static java.util.Map<java.lang.Object,java.util.List<ITestNGMethod>> sortMethodsByInstance(ITestNGMethod[] methods)
methods
- Methods to be sortedprotected static java.lang.String calculateMethodCanonicalName(ITestNGMethod m)
private static java.lang.String calculateMethodCanonicalName(java.lang.reflect.Method m)
private static java.util.List<ITestNGMethod> sortMethods(boolean forTests, java.util.List<ITestNGMethod> allMethods, java.util.Comparator<ITestNGMethod> comparator)
public static java.util.List<ITestNGMethod> getMethodsDependedUpon(ITestNGMethod method, ITestNGMethod[] methods, java.util.Comparator<ITestNGMethod> comparator)
public static void fixMethodsWithClass(ITestNGMethod[] methods, ITestClass testCls, java.util.List<ITestNGMethod> methodList)
public static java.util.List<ITestNGMethod> invokedMethodsToMethods(java.util.Collection<IInvokedMethod> invokedMethods)
public static java.util.List<IMethodInstance> methodsToMethodInstances(java.util.List<ITestNGMethod> sl)
public static java.util.List<ITestNGMethod> methodInstancesToMethods(java.util.List<IMethodInstance> methodInstances)
public static void dumpInvokedMethodsInfoToConsole(java.util.Collection<IInvokedMethod> iInvokedMethods, int currentVerbosity)
protected static java.lang.String calculateMethodCanonicalName(java.lang.Class<?> methodClass, java.lang.String methodName)
protected static long calculateTimeOut(ITestNGMethod tm)
private static MethodHelper.MatchResults matchMethod(ITestNGMethod[] methods, java.lang.String regexp)