    001    package org.junit;
    002
    003    import java.lang.annotation.ElementType;
    004    import java.lang.annotation.Retention;
    005    import java.lang.annotation.RetentionPolicy;
    006    import java.lang.annotation.Target;
    007
    008    /**
    009     * Sometimes several tests need to share computationally expensive setup
    010     * (like logging into a database). While this can compromise the independence of
    011     * tests, sometimes it is a necessary optimization. Annotating a <code>public static void</code> no-arg method
    012     * with <code>@BeforeClass</code> causes it to be run once before any of
    013     * the test methods in the class. The <code>@BeforeClass</code> methods of superclasses
    014     * will be run before those of the current class, unless they are shadowed in the current class.
    015     * <p>
    016     * For example:
    017     * <pre>
    018     * public class Example {
    019     *    &#064;BeforeClass public static void onlyOnce() {
    020     *       ...
    021     *    }
    022     *    &#064;Test public void one() {
    023     *       ...
    024     *    }
    025     *    &#064;Test public void two() {
    026     *       ...
    027     *    }
    028     * }
    029     * </pre>
    030     *
    031     * @see org.junit.AfterClass
    032     * @since 4.0
    033     */
    034    @Retention(RetentionPolicy.RUNTIME)
    035    @Target(ElementType.METHOD)
    036    public @interface BeforeClass {
    037    }