KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > junit > runner > RunWith


1 package org.junit.runner;
2
3 import java.lang.annotation.ElementType JavaDoc;
4 import java.lang.annotation.Inherited JavaDoc;
5 import java.lang.annotation.Retention JavaDoc;
6 import java.lang.annotation.RetentionPolicy JavaDoc;
7 import java.lang.annotation.Target JavaDoc;
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 @Retention JavaDoc(RetentionPolicy.RUNTIME)
27 @Target JavaDoc(ElementType.TYPE)
28 @Inherited JavaDoc
29 public @interface RunWith {
30     /**
31      * @return a Runner class (must have a constructor that takes a single Class to run)
32      */

33     Class JavaDoc<? extends Runner> value();
34 }
35
Popular Tags