01: package org.junit;
02:
03: import java.lang.annotation.ElementType;
04: import java.lang.annotation.Retention;
05: import java.lang.annotation.RetentionPolicy;
06: import java.lang.annotation.Target;
07:
08: /**
09: * <p>When writing tests, it is common to find that several tests need similar
10: * objects created before they can run. Annotating a <code>public void</code> method
11: * with <code>@Before</code> causes that method to be run before the {@link org.junit.Test} method.
12: * The <code>@Before</code> methods of superclasses will be run before those of the current class.</p>
13: *
14: * Here is a simple example:
15: * <pre>
16: * public class Example {
17: * List empty;
18: * @Before public void initialize() {
19: * empty= new ArrayList();
20: * }
21: * @Test public void size() {
22: * ...
23: * }
24: * @Test public void remove() {
25: * ...
26: * }
27: * }
28: * </pre>
29: *
30: * @see org.junit.BeforeClass
31: * @see org.junit.After
32: */
33: @Retention(RetentionPolicy.RUNTIME)
34: @Target(ElementType.METHOD)
35: public @interface Before {
36: }
|