001 package org.junit.runner; 002 003 import java.lang.annotation.ElementType; 004 import java.lang.annotation.Inherited; 005 import java.lang.annotation.Retention; 006 import java.lang.annotation.RetentionPolicy; 007 import java.lang.annotation.Target; 008 009 /** 010 * When a class is annotated with <code>@RunWith</code> or extends a class annotated 011 * with <code>@RunWith</code>, JUnit will invoke the class it references to run the 012 * tests in that class instead of the runner built into JUnit. We added this feature late 013 * in development. While it seems powerful we expect the runner API to change as we learn 014 * how people really use it. Some of the classes that are currently internal will likely 015 * be refined and become public. 016 * 017 * For example, suites in JUnit 4 are built using RunWith, and a custom runner named Suite: 018 * 019 * <pre> 020 * @RunWith(Suite.class) 021 * @SuiteClasses({ATest.class, BTest.class, CTest.class}) 022 * public class ABCSuite { 023 * } 024 * </pre> 025 * 026 * @since 4.0 027 */ 028 @Retention(RetentionPolicy.RUNTIME) 029 @Target(ElementType.TYPE) 030 @Inherited 031 public @interface RunWith { 032 /** 033 * @return a Runner class (must have a constructor that takes a single Class to run) 034 */ 035 Class<? extends Runner> value(); 036 }