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