public class MethodInheritance
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Comparator<ITestNGMethod> |
COMPARATOR
A Custom comparator that helps in
ITestNGMethod ordering keeping in mind the class
hierarchy. |
Constructor and Description |
---|
MethodInheritance() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
dependencyExists(ITestNGMethod m1,
ITestNGMethod m2,
ITestNGMethod[] methods) |
private static boolean |
equalsEffectiveClass(ITestNGMethod m1,
ITestNGMethod m2) |
private static java.util.List<ITestNGMethod> |
findMethodListSuperClass(java.util.Map<java.lang.Class,java.util.List<ITestNGMethod>> map,
java.lang.Class<? extends ITestNGMethod> methodClass)
Look in map for a class that is a superclass of methodClass
|
private static java.lang.Class |
findSubClass(java.util.Map<java.lang.Class,java.util.List<ITestNGMethod>> map,
java.lang.Class<? extends ITestNGMethod> methodClass)
Look in map for a class that is a subclass of methodClass
|
static void |
fixMethodInheritance(ITestNGMethod[] methods,
boolean before)
Fix the methodsDependedUpon to make sure that @Configuration methods respect inheritance
(before methods are invoked in the order Base first and after methods are invoked in the order
Child first)
|
private static boolean |
internalDependencyExists(ITestNGMethod m1,
ITestNGMethod m2,
ITestNGMethod[] methods) |
private static void |
sortMethodsByInheritance(java.util.List<ITestNGMethod> methods,
boolean baseClassToChild)
Given a list of methods belonging to the same class hierarchy, orders them from the base class
to the child (if true) or from child to base class (if false)
|
private static final java.util.Comparator<ITestNGMethod> COMPARATOR
ITestNGMethod
ordering keeping in mind the class
hierarchy. Here's how the comparator works: private static java.util.List<ITestNGMethod> findMethodListSuperClass(java.util.Map<java.lang.Class,java.util.List<ITestNGMethod>> map, java.lang.Class<? extends ITestNGMethod> methodClass)
private static java.lang.Class findSubClass(java.util.Map<java.lang.Class,java.util.List<ITestNGMethod>> map, java.lang.Class<? extends ITestNGMethod> methodClass)
public static void fixMethodInheritance(ITestNGMethod[] methods, boolean before)
methods
- the list of methodsbefore
- true if we are handling a before method (meaning, the methods need to be sorted
base class first and subclass last). false otherwise (subclass methods first, base classes
last).private static boolean dependencyExists(ITestNGMethod m1, ITestNGMethod m2, ITestNGMethod[] methods)
private static boolean internalDependencyExists(ITestNGMethod m1, ITestNGMethod m2, ITestNGMethod[] methods)
private static boolean equalsEffectiveClass(ITestNGMethod m1, ITestNGMethod m2)
private static void sortMethodsByInheritance(java.util.List<ITestNGMethod> methods, boolean baseClassToChild)