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>If you allocate external resources in a {@link org.junit.Before} method you need to release them
010 * after the test runs. Annotating a <code>public void</code> method
011 * with <code>&#064;After</code> causes that method to be run after the {@link org.junit.Test} method. All <code>&#064;After</code>
012 * methods are guaranteed to run even if a {@link org.junit.Before} or {@link org.junit.Test} method throws an
013 * exception. The <code>&#064;After</code> methods declared in superclasses will be run after those of the current
014 * class, unless they are overridden in the current class.</p>
015 *
016 * Here is a simple example:
017 * <pre>
018 * public class Example {
019 *    File output;
020 *    &#064;Before public void createOutputFile() {
021 *          output= new File(...);
022 *    }
023 *    &#064;Test public void something() {
024 *          ...
025 *    }
026 *    &#064;After public void deleteOutputFile() {
027 *          output.delete();
028 *    }
029 * }
030 * </pre>
031 *
032 * @see org.junit.Before
033 * @see org.junit.Test
034 * @since 4.0
035 */
036
037@Retention(RetentionPolicy.RUNTIME)
038@Target(ElementType.METHOD)
039public @interface After {
040}
041