001package org.junit;
002
003import java.lang.annotation.ElementType;
004import java.lang.annotation.Retention;
005import java.lang.annotation.RetentionPolicy;
006import java.lang.annotation.Target;
007
008/**
009 * <p>When writing tests, it is common to find that several tests need similar
010 * objects created before they can run. Annotating a <code>public void</code> method
011 * with <code>&#064;Before</code> causes that method to be run before the {@link org.junit.Test} method.
012 * The <code>&#064;Before</code> methods of superclasses will be run before those of the current class,
013 * unless they are overridden in the current class. No other ordering is defined.
014 * </p>
015 *
016 * Here is a simple example:
017 * <pre>
018 * public class Example {
019 *    List empty;
020 *    &#064;Before public void initialize() {
021 *       empty= new ArrayList();
022 *    }
023 *    &#064;Test public void size() {
024 *       ...
025 *    }
026 *    &#064;Test public void remove() {
027 *       ...
028 *    }
029 * }
030 * </pre>
031 *
032 * @see org.junit.BeforeClass
033 * @see org.junit.After
034 * @since 4.0
035 */
036@Retention(RetentionPolicy.RUNTIME)
037@Target(ElementType.METHOD)
038public @interface Before {
039}
040