forked from testng-team/testng
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Honour Insertion order for listeners
Closes testng-team#2558
- Loading branch information
1 parent
68feee1
commit 888cf56
Showing
16 changed files
with
437 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
testng-core/src/test/java/test/listeners/github2558/CallHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package test.listeners.github2558; | ||
|
||
import java.util.List; | ||
import org.assertj.core.util.Lists; | ||
|
||
public class CallHolder { | ||
|
||
private static final List<String> calls = Lists.newArrayList(); | ||
|
||
public static void addCall(String identifier) { | ||
calls.add(identifier); | ||
} | ||
|
||
public static void clear() { | ||
calls.clear(); | ||
} | ||
|
||
public static List<String> getCalls() { | ||
return calls; | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
testng-core/src/test/java/test/listeners/github2558/ClassMethodListenersHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package test.listeners.github2558; | ||
|
||
import org.testng.IClassListener; | ||
import org.testng.IInvokedMethod; | ||
import org.testng.IInvokedMethodListener; | ||
import org.testng.ITestClass; | ||
import org.testng.ITestResult; | ||
|
||
public class ClassMethodListenersHolder { | ||
|
||
public static class ClassMethodListenerA implements IClassListener, IInvokedMethodListener { | ||
|
||
@Override | ||
public void onBeforeClass(ITestClass testClass) { | ||
CallHolder.addCall(getClass().getName() + ".onBeforeClass()"); | ||
} | ||
|
||
@Override | ||
public void onAfterClass(ITestClass testClass) { | ||
CallHolder.addCall(getClass().getName() + ".onBeforeClass()"); | ||
} | ||
|
||
@Override | ||
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { | ||
if (method.isConfigurationMethod()) { | ||
return; | ||
} | ||
CallHolder.addCall(getClass().getName() + ".beforeInvocation()"); | ||
} | ||
|
||
@Override | ||
public void afterInvocation(IInvokedMethod method, ITestResult testResult) { | ||
if (method.isConfigurationMethod()) { | ||
return; | ||
} | ||
CallHolder.addCall(getClass().getName() + ".afterInvocation()"); | ||
} | ||
} | ||
|
||
public static class ClassMethodListenerB implements IClassListener, IInvokedMethodListener { | ||
|
||
@Override | ||
public void onBeforeClass(ITestClass testClass) { | ||
CallHolder.addCall(getClass().getName() + ".onBeforeClass()"); | ||
} | ||
|
||
@Override | ||
public void onAfterClass(ITestClass testClass) { | ||
CallHolder.addCall(getClass().getName() + ".onBeforeClass()"); | ||
} | ||
|
||
@Override | ||
public void beforeInvocation(IInvokedMethod method, ITestResult testResult) { | ||
if (method.isConfigurationMethod()) { | ||
return; | ||
} | ||
CallHolder.addCall(getClass().getName() + ".beforeInvocation()"); | ||
} | ||
|
||
@Override | ||
public void afterInvocation(IInvokedMethod method, ITestResult testResult) { | ||
if (method.isConfigurationMethod()) { | ||
return; | ||
} | ||
CallHolder.addCall(getClass().getName() + ".afterInvocation()"); | ||
} | ||
} | ||
} |
Oops, something went wrong.