forked from junit-team/junit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestClassOrder.java
More file actions
85 lines (78 loc) · 2.63 KB
/
TestClassOrder.java
File metadata and controls
85 lines (78 loc) · 2.63 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
/*
* Copyright 2015-2025 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.STABLE;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apiguardian.api.API;
/**
* {@code @TestClassOrder} is a type-level annotation that is used to configure
* a {@link #value ClassOrderer} for the {@link Nested @Nested} test classes of
* the annotated test class.
*
* <p>If {@code @TestClassOrder} is not explicitly declared on a test class,
* inherited from a parent class, declared on a test interface implemented by
* a test class, or inherited from an {@linkplain Class#getEnclosingClass() enclosing
* class}, {@code @Nested} test classes will be ordered using a default
* algorithm that is deterministic but intentionally nonobvious.
*
* <p>As an alternative to {@code @TestClassOrder}, a global {@link ClassOrderer}
* can be configured for the entire test suite via the
* {@value ClassOrderer#DEFAULT_ORDER_PROPERTY_NAME} configuration parameter. See
* the User Guide for details. Note, however, that a {@code @TestClassOrder}
* declaration always overrides a global {@code ClassOrderer}.
*
* <h2>Example Usage</h2>
*
* <p>The following demonstrates how to guarantee that {@code @Nested} test classes
* are executed in the order specified via the {@link Order @Order} annotation.
*
* <pre class="code">
* {@literal @}TestClassOrder(ClassOrderer.OrderAnnotation.class)
* class OrderedNestedTests {
*
* {@literal @}Nested
* {@literal @}Order(1)
* class PrimaryTests {
* // {@literal @}Test methods ...
* }
*
* {@literal @}Nested
* {@literal @}Order(2)
* class SecondaryTests {
* // {@literal @}Test methods ...
* }
* }</pre>
*
* @since 5.8
* @see ClassOrderer
* @see TestMethodOrder
*/
@API(status = STABLE, since = "5.10")
@Documented
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface TestClassOrder {
/**
* The {@link ClassOrderer} to use.
*
* @see ClassOrderer
* @see ClassOrderer.ClassName
* @see ClassOrderer.DisplayName
* @see ClassOrderer.OrderAnnotation
* @see ClassOrderer.Random
*/
Class<? extends ClassOrderer> value();
}