Home | History | Annotate | Download | only in categories
      1 package org.junit.experimental.categories;
      2 
      3 import java.lang.annotation.Inherited;
      4 import java.lang.annotation.Retention;
      5 import java.lang.annotation.RetentionPolicy;
      6 
      7 import org.junit.validator.ValidateWith;
      8 
      9 /**
     10  * Marks a test class or test method as belonging to one or more categories of tests.
     11  * The value is an array of arbitrary classes.
     12  *
     13  * This annotation is only interpreted by the Categories runner (at present).
     14  *
     15  * For example:
     16  * <pre>
     17  * public interface FastTests {}
     18  * public interface SlowTests {}
     19  *
     20  * public static class A {
     21  * &#064;Test
     22  * public void a() {
     23  * fail();
     24  * }
     25  *
     26  * &#064;Category(SlowTests.class)
     27  * &#064;Test
     28  * public void b() {
     29  * }
     30  * }
     31  *
     32  * &#064;Category({SlowTests.class, FastTests.class})
     33  * public static class B {
     34  * &#064;Test
     35  * public void c() {
     36  *
     37  * }
     38  * }
     39  * </pre>
     40  *
     41  * For more usage, see code example on {@link Categories}.
     42  */
     43 @Retention(RetentionPolicy.RUNTIME)
     44 @Inherited
     45 @ValidateWith(CategoryValidator.class)
     46 public @interface Category {
     47     Class<?>[] value();
     48 }