carbidecpp20devenv/plugins/org.eclipse.test.source_3.3.0.v20080507/src/org.junit4_4.3.1/junitsrc/org/junit/Before.java
changeset 1 82d1d1de1a01
equal deleted inserted replaced
-1:000000000000 1:82d1d1de1a01
       
     1 package org.junit;
       
     2 
       
     3 import java.lang.annotation.ElementType;
       
     4 import java.lang.annotation.Retention;
       
     5 import java.lang.annotation.RetentionPolicy;
       
     6 import java.lang.annotation.Target;
       
     7 
       
     8 /**
       
     9  * <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>&#064;Before</code> causes that method to be run before the {@link org.junit.Test} method.
       
    12  * The <code>&#064;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  *    &#064;Before public void initialize() {
       
    19  *       empty= new ArrayList();
       
    20  *    }
       
    21  *    &#064;Test public void size() {
       
    22  *       ...
       
    23  *    }
       
    24  *    &#064;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 }
       
    37