• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.junit.runner;
2 
3 import java.lang.annotation.ElementType;
4 import java.lang.annotation.Inherited;
5 import java.lang.annotation.Retention;
6 import java.lang.annotation.RetentionPolicy;
7 import java.lang.annotation.Target;
8 
9 /**
10  * When a class is annotated with <code>&#064;RunWith</code> or extends a class annotated
11  * with <code>&#064;RunWith</code>, JUnit will invoke the class it references to run the
12  * tests in that class instead of the runner built into JUnit. We added this feature late
13  * in development. While it seems powerful we expect the runner API to change as we learn
14  * how people really use it. Some of the classes that are currently internal will likely
15  * be refined and become public.
16  *
17  * For example, suites in JUnit 4 are built using RunWith, and a custom runner named Suite:
18  *
19  * <pre>
20  * &#064;RunWith(Suite.class)
21  * &#064;SuiteClasses({ATest.class, BTest.class, CTest.class})
22  * public class ABCSuite {
23  * }
24  * </pre>
25  *
26  * @since 4.0
27  */
28 @Retention(RetentionPolicy.RUNTIME)
29 @Target(ElementType.TYPE)
30 @Inherited
31 public @interface RunWith {
32     /**
33      * @return a Runner class (must have a constructor that takes a single Class to run)
34      */
value()35     Class<? extends Runner> value();
36 }
37