1 package eu.simuline.testhelpers;
2
3 import org.junit.runner.notification.RunListener;
4
5 import org.junit.runner.Description;
6
7 /**
8 * Extension of {@link RunListener}, version junit 4.12.
9 * adds methods
10 * <ul>
11 * <li>
12 * {@link #testSuiteStarted(Description)} and
13 * {@link #testSuiteFinished(Description)}
14 * which is added to {@link RunListener}, version junit 4.13
15 * which is not yet available.
16 * <li>
17 * {@link #testRunAborted()} and {@link #testClassStructureLoaded(Description)}
18 * needed in conjunction with our user interfaces.
19 * </ul>
20 *
21 * @author <a href="mailto:ernst.reissner@simuline.eu">Ernst Reissner</a>
22 * @version 1.0
23 */
24 public class ExtRunListener extends RunListener {
25
26 // api-docs inherited from class RunListener
27 // starting with junit 4.13 but this one uses 4.12
28 /**
29 * Called when a test suite is about to be started.
30 * If this method is called for a given {@link Description},
31 * then {@link #testSuiteFinished(Description)}
32 * will also be called for the same {@code Description}.
33 * <p>
34 * Note that not all runners will call this method, so runners should
35 * be prepared to handle {@link #testStarted(Description)} calls for tests
36 * where there was no corresponding {@link #testSuiteStarted(Description)}
37 * call for the parent {@link Description}.
38 *
39 * @param desc
40 * the description of the test suite that is about to be run
41 * (generally a class name)
42 * @since 4.13
43 */
44 public void testSuiteStarted(Description desc) throws Exception { //NOPMD
45 }
46
47 // api-docs inherited from class RunListener
48 // starting with junit 4.13 but this one uses 4.12
49 /**
50 * Called when a test suite has finished,
51 * whether the test suite succeeds or fails.
52 * This method will not be called for a given {@link Description}
53 * unless {@link #testSuiteStarted(Description)} was called
54 * for the same {@link Description}.
55 *
56 * @param desc
57 * the description of the test suite that just ran
58 * @since 4.13
59 */
60 public void testSuiteFinished(Description desc) throws Exception { //NOPMD
61 }
62
63
64 // homemade extension
65 /**
66 * Invoked for stop and for break originated by the user.
67 */
68 // not clear which test has been aborted.
69 public void testRunAborted() {
70 }
71
72 // homemade extension
73 /**
74 * Invoked if a test class is loaded defining a testsuite
75 * described by <code>desc</code>.
76 */
77 public void testClassStructureLoaded(final Description desc) {
78 }
79 }