public class ChainingRunNotifierWrapper
extends RunNotifier
RunNotifier to extend the listener concept to act like a chain in meaning of having revert order on
test finalizing. For this the listener added will not be passed to the wrapped instance to avoid calling them twice,
so the wrapped instance holds only the instances assigned before wrapping. As the BlockJUnit4ClassRunner is
used differently in environments there is no chance to intercept the RunNotifier creation, so this wrapper
can be used first at entry of BlockJUnit4ClassRunner#run(RunNotifier) method. Unfortunately the firing of
events for a complete test run are done outside. With that this events will not be delegatet to the wrapper instance
in general as they will be called separately outside of run method.| Constructor and Description |
|---|
ChainingRunNotifierWrapper(RunNotifier delegate)
Creates a new notifier using passed notifier as delegate.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFirstListener(RunListener listener)
Adds the listener as first listener to this notifier, not to wrapped one.
|
void |
addListener(RunListener listener)
Adds the listener to this notifier, will not be added to wrapped one.
|
void |
fireTestAssumptionFailed(Failure failure)
Delegates to wrapper first, then calls
RunListener#testAssumptionFailure(Failure) for all listeners in
normal order. |
void |
fireTestFailure(Failure failure)
Delegates to wrapper first, then calls
RunListener#testFailure(Failure) for all listeners in reverse
order. |
void |
fireTestFinished(Description description)
Calls
RunListener#testFinished(Description) for all listeners in reversed order, afterwards it calls
wrapper implementation. |
void |
fireTestIgnored(Description description)
Delegates to wrapper first, then calls
RunListener#testIgnored(Description) for all listeners in normal
order. |
void |
fireTestRunFinished(Result result)
Calls
RunListener#testRunFinished(Result) for all listeners in reverse order. |
void |
fireTestRunStarted(Description description)
Calls
RunListener#testRunStarted(Description) for all listeners in normal order. |
void |
fireTestStarted(Description description)
Delegates to wrapper first, then calls
RunListener#testStarted(Description) for all listeners in normal
order. |
void |
pleaseStop()
Simply delegates to wrapped runner.
|
protected Description |
recreateTestDescription(Description description) |
void |
removeAllListeners()
Removes all listeners for this runner.
|
void |
removeListener(RunListener listener)
Removes the listener from wrapped notifier and this notifier.
|
public ChainingRunNotifierWrapper(RunNotifier delegate)
public void addFirstListener(RunListener listener)
public void addListener(RunListener listener)
public void removeListener(RunListener listener)
public void fireTestRunStarted(Description description)
RunListener#testRunStarted(Description) for all listeners in normal order. No call to wrapper will
be done as listeners of wrapper will be called outside of run method of ClassRunner.public void fireTestRunFinished(Result result)
RunListener#testRunFinished(Result) for all listeners in reverse order. No call to wrapper will be
done as listeners of wrapper will are called already outside of run method of ClassRunner.public void fireTestStarted(Description description)
throws StoppedByUserException
RunListener#testStarted(Description) for all listeners in normal
order.StoppedByUserExceptionpublic void fireTestFailure(Failure failure)
RunListener#testFailure(Failure) for all listeners in reverse
order.public void fireTestAssumptionFailed(Failure failure)
RunListener#testAssumptionFailure(Failure) for all listeners in
normal order.public void fireTestIgnored(Description description)
RunListener#testIgnored(Description) for all listeners in normal
order.public void fireTestFinished(Description description)
RunListener#testFinished(Description) for all listeners in reversed order, afterwards it calls
wrapper implementation.protected Description recreateTestDescription(Description description)
public void pleaseStop()
public void removeAllListeners()
Copyright © 2018 SAP SE. All Rights Reserved.