Package org.testng.internal
Class ListenerOrderDeterminer
java.lang.Object
org.testng.internal.ListenerOrderDeterminer
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.
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarrange
(Collection<T> original) static <T> List
<T> order
(Collection<T> original) static <T> List
<T> reversedOrder
(Collection<T> original)
-
Field Details
-
PREFERENTIAL_PACKAGES
-
SHOULD_ADD_AT_END
-
-
Constructor Details
-
ListenerOrderDeterminer
private ListenerOrderDeterminer()
-
-
Method Details
-
order
- Parameters:
original
- - The original collection of listeners- Returns:
- - A re-ordered collection wherein preferential listeners are added at the end
-
reversedOrder
- 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.
-
arrange
-