Package org.testng.internal
Class ListenerOrderDeterminer
- java.lang.Object
-
- org.testng.internal.ListenerOrderDeterminer
-
public final class ListenerOrderDeterminer extends java.lang.Object
A Utility that helps us differentiate between a user's listener and preferential Listener.When dealing with TestNG listeners we would need to ensure that the user created listeners are invoked first followed by Preferential listeners. This is required so that we always honour any state changes that a user's listener may have done to the internal state of objects that can affect the outcome of the execution (for e.g.,
ITestResult
)The ordering must be done such that, when dealing with "beforeXXX|afterXXX" we group all the IDE listeners at the end. That way, we can always ensure that the preferential listeners (for e.g., IDE listeners) always honour the changes that were done to the TestNG internal states and give a consistent experience for users.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends ITestNGListener>
java.util.List<T>order(java.util.Collection<T> original, ListenerComparator comparator)
static <T extends ITestNGListener>
java.util.List<T>reversedOrder(java.util.Collection<T> original, ListenerComparator comparator)
-
-
-
Method Detail
-
order
public static <T extends ITestNGListener> java.util.List<T> order(java.util.Collection<T> original, ListenerComparator comparator)
- Parameters:
original
- - The original collection of listeners- Returns:
- - A re-ordered collection wherein preferential listeners are added at the end
-
reversedOrder
public static <T extends ITestNGListener> java.util.List<T> reversedOrder(java.util.Collection<T> original, ListenerComparator comparator)
- Parameters:
original
- - The original collection of listeners- Returns:
- - A reversed ordered list wherein the user listeners are found in reverse order followed by preferential listeners also in reverse order.
-
-