001 package org.junit.experimental.categories;
002
003 import java.lang.annotation.Inherited;
004 import java.lang.annotation.Retention;
005 import java.lang.annotation.RetentionPolicy;
006
007 import org.junit.validator.ValidateWith;
008
009 /**
010 * Marks a test class or test method as belonging to one or more categories of tests.
011 * The value is an array of arbitrary classes.
012 *
013 * This annotation is only interpreted by the Categories runner (at present).
014 *
015 * For example:
016 * <pre>
017 * public interface FastTests {}
018 * public interface SlowTests {}
019 *
020 * public static class A {
021 * @Test
022 * public void a() {
023 * fail();
024 * }
025 *
026 * @Category(SlowTests.class)
027 * @Test
028 * public void b() {
029 * }
030 * }
031 *
032 * @Category({SlowTests.class, FastTests.class})
033 * public static class B {
034 * @Test
035 * public void c() {
036 *
037 * }
038 * }
039 * </pre>
040 *
041 * For more usage, see code example on {@link Categories}.
042 */
043 @Retention(RetentionPolicy.RUNTIME)
044 @Inherited
045 @ValidateWith(CategoryValidator.class)
046 public @interface Category {
047 Class<?>[] value();
048 }