diff -r 000000000000 -r 82d1d1de1a01 carbidecpp20devenv/plugins/org.eclipse.test.source_3.3.0.v20080507/src/org.junit4_4.3.1/junitsrc/org/junit/runner/notification/RunListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/carbidecpp20devenv/plugins/org.eclipse.test.source_3.3.0.v20080507/src/org.junit4_4.3.1/junitsrc/org/junit/runner/notification/RunListener.java Wed Mar 18 17:21:00 2009 -0500 @@ -0,0 +1,81 @@ +package org.junit.runner.notification; + +import org.junit.runner.Description; +import org.junit.runner.Result; + +/** + *

If you need to respond to the events during a test run, extend RunListener + * and override the appropriate methods. If a listener throws an exception while processing a + * test event, it will be removed for the remainder of the test run.

+ * + *

For example, suppose you have a Cowbell + * class that you want to make a noise whenever a test fails. You could write: + *

+ * public class RingingListener extends RunListener {
+ *    public void testFailure(Failure failure) {
+ *       Cowbell.ring();
+ *    }
+ * }
+ * 
+ *

+ * + *

To invoke your listener, you need to run your tests through JUnitCore. + *

+ * public void main(String... args) {
+ *    JUnitCore core= new JUnitCore();
+ *    core.addListener(new RingingListener());
+ *    core.run(MyTestClass.class);
+ * }
+ * 
+ *

+ * @see org.junit.runner.JUnitCore + */ +public class RunListener { + + /** + * Called before any tests have been run. + * @param description describes the tests to be run + */ + public void testRunStarted(Description description) throws Exception { + } + + /** + * Called when all tests have finished + * @param result the summary of the test run, including all the tests that failed + */ + public void testRunFinished(Result result) throws Exception { + } + + /** + * Called when an atomic test is about to be started. + * @param description the description of the test that is about to be run + * (generally a class and method name) + */ + public void testStarted(Description description) throws Exception { + } + + /** + * Called when an atomic test has finished, whether the test succeeds or fails. + * @param description the description of the test that just ran + */ + public void testFinished(Description description) throws Exception { + } + + /** + * Called when an atomic test fails. + * @param failure describes the test that failed and the exception that was thrown + */ + public void testFailure(Failure failure) throws Exception { + } + + /** + * Called when a test will not be run, generally because a test method is annotated + * with {@link org.junit.Ignore}. + * @param description describes the test that will not be run + */ + public void testIgnored(Description description) throws Exception { + } + +} + +