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 * 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 * Here is a simple example:
016 * <pre>
017 * public class Example {
018 *    List empty;
019 *    &#064;Before public void initialize() {
020 *       empty= new ArrayList();
021 *    }
022 *    &#064;Test public void size() {
023 *       ...
024 *    }
025 *    &#064;Test public void remove() {
026 *       ...
027 *    }
028 * }
029 * </pre>
030 *
031 * @see org.junit.BeforeClass
032 * @see org.junit.After
033 * @since 4.0
034 */
035@Retention(RetentionPolicy.RUNTIME)
036@Target(ElementType.METHOD)
037public @interface Before {
038}
039