1package org.junit; 2 3import java.lang.annotation.ElementType; 4import java.lang.annotation.Retention; 5import java.lang.annotation.RetentionPolicy; 6import java.lang.annotation.Target; 7 8/** 9 * If you allocate external resources in a {@link org.junit.Before} method you need to release them 10 * after the test runs. Annotating a <code>public void</code> method 11 * with <code>@After</code> causes that method to be run after the {@link org.junit.Test} method. All <code>@After</code> 12 * methods are guaranteed to run even if a {@link org.junit.Before} or {@link org.junit.Test} method throws an 13 * exception. The <code>@After</code> methods declared in superclasses will be run after those of the current 14 * class, unless they are overridden in the current class. 15 * <p> 16 * Here is a simple example: 17 * <pre> 18 * public class Example { 19 * File output; 20 * @Before public void createOutputFile() { 21 * output= new File(...); 22 * } 23 * @Test public void something() { 24 * ... 25 * } 26 * @After public void deleteOutputFile() { 27 * output.delete(); 28 * } 29 * } 30 * </pre> 31 * 32 * @see org.junit.Before 33 * @see org.junit.Test 34 * @since 4.0 35 */ 36 37@Retention(RetentionPolicy.RUNTIME) 38@Target(ElementType.METHOD) 39public @interface After { 40} 41 42