|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.junit.rules.TestWatchman
TestWatcher
(which implements TestRule
) instead.
@Deprecated public class TestWatchman
TestWatchman is a base class for Rules that take note of the testing action, without modifying it. For example, this class will keep a log of each passing and failing test:
public static class WatchmanTest { private static String watchedLog; @Rule public MethodRule watchman= new TestWatchman() { @Override public void failed(Throwable e, FrameworkMethod method) { watchedLog+= method.getName() + " " + e.getClass().getSimpleName() + "\n"; } @Override public void succeeded(FrameworkMethod method) { watchedLog+= method.getName() + " " + "success!\n"; } }; @Test public void fails() { fail(); } @Test public void succeeds() { } }
Constructor Summary | |
---|---|
TestWatchman()
Deprecated. |
Method Summary | |
---|---|
Statement |
apply(Statement base,
FrameworkMethod method,
Object target)
Deprecated. Modifies the method-running Statement to implement an additional
test-running rule. |
void |
failed(Throwable e,
FrameworkMethod method)
Deprecated. Invoked when a test method fails |
void |
finished(FrameworkMethod method)
Deprecated. Invoked when a test method finishes (whether passing or failing) |
void |
starting(FrameworkMethod method)
Deprecated. Invoked when a test method is about to start |
void |
succeeded(FrameworkMethod method)
Deprecated. Invoked when a test method succeeds |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TestWatchman()
Method Detail |
---|
public Statement apply(Statement base, FrameworkMethod method, Object target)
MethodRule
Statement
to implement an additional
test-running rule.
apply
in interface MethodRule
base
- The Statement
to be modifiedmethod
- The method to be runtarget
- The object on which the method will be run.
base
,
a wrapper around base
, or a completely new Statement.public void succeeded(FrameworkMethod method)
public void failed(Throwable e, FrameworkMethod method)
public void starting(FrameworkMethod method)
public void finished(FrameworkMethod method)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |