Debian Codegraph @

junit-jupiter-api/src/main/java/org/junit/jupiter/api/Order.java

raw symbols SCIP
1 /*
2 * Copyright 2015-2024 the original author or authors.
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v2.0 which
6 * accompanies this distribution and is available at
7 *
8 * https://www.eclipse.org/legal/epl-v20.html
9 */
10
11 package org.junit.jupiter.api;
12
13 import static org.apiguardian.api.API.Status.STABLE;
14
15 import java.lang.annotation.Documented;
16 import java.lang.annotation.ElementType;
17 import java.lang.annotation.Retention;
18 import java.lang.annotation.RetentionPolicy;
19 import java.lang.annotation.Target;
20
21 import org.apiguardian.api.API;
22
23 /**
24 * {@code @Order} is an annotation that is used to configure the
25 * {@linkplain #value order} in which the annotated element (i.e., field,
26 * method, or class) should be evaluated or executed relative to other elements
27 * of the same category.
28 *
29 * <p>When used with
30 * {@link org.junit.jupiter.api.extension.RegisterExtension @RegisterExtension} or
31 * {@link org.junit.jupiter.api.extension.ExtendWith @ExtendWith},
32 * the category applies to <em>extension fields</em>. When used with
33 * {@link MethodOrderer.OrderAnnotation}, the category applies to <em>test methods</em>.
34 * When used with {@link ClassOrderer.OrderAnnotation}, the category applies to
35 * <em>test classes</em>.
36 *
37 * <p>If {@code @Order} is not explicitly declared on an element, the
38 * {@link #DEFAULT} order value will be assigned to the element.
39 *
40 * @since 5.4
41 * @see MethodOrderer.OrderAnnotation
42 * @see ClassOrderer.OrderAnnotation
43 * @see org.junit.jupiter.api.extension.RegisterExtension @RegisterExtension
44 * @see org.junit.jupiter.api.extension.ExtendWith @ExtendWith
45 */
46 @Target({ ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
47 @Retention(RetentionPolicy.RUNTIME)
48 @Documented
49 @API(status = STABLE, since = "5.9")
50 public @interface Order {
51
52 /**
53 * Default order value for elements not explicitly annotated with {@code @Order},
54 * equal to the value of {@code Integer.MAX_VALUE / 2}.
55 *
56 * @since 5.6
57 * @see Order#value
58 */
59 int DEFAULT = Integer.MAX_VALUE / 2;
60
61 /**
62 * The order value for the annotated element (i.e., field, method, or class).
63 *
64 * <p>Elements are ordered based on priority where a lower value has greater
65 * priority than a higher value. For example, {@link Integer#MAX_VALUE} has
66 * the lowest priority.
67 *
68 * @see #DEFAULT
69 */
70 int value();
71
72 }