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
008import org.junit.runners.MethodSorters;
009
010/**
011 * This class allows the user to choose the order of execution of the methods within a test class.
012 * <br/>
013 * <br/>
014 * The default order of execution of JUnit tests within a class is deterministic but not predictable.
015 * The order of execution is not guaranteed for Java 7 (and some previous versions), and can even change
016 * from run to run, so the order of execution was changed to be deterministic (in JUnit 4.11)
017 * <br/>
018 * It is recommended that test methods be written so that they are independent of the order that they are executed.
019 * However, there may be a number of dependent tests either through error or by design.
020 * This class allows the user to specify the order of execution of test methods.
021 * <br/>
022 * For possibilities, see {@link MethodSorters}
023 *
024 * Here is an example:
025 *
026 * <pre>
027 * &#064;FixMethodOrder(MethodSorters.NAME_ASCENDING)
028 * public class MyTest {
029 * }
030 * </pre>
031 *
032 * @see org.junit.runners.MethodSorters
033 * @since 4.11
034 */
035@Retention(RetentionPolicy.RUNTIME)
036@Target({ElementType.TYPE})
037public @interface FixMethodOrder {
038    /**
039     * Optionally specify <code>value</code> to have the methods executed in a particular order
040     */
041    MethodSorters value() default MethodSorters.DEFAULT;
042}