| 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.parallel; |
| 12 | |
| 13 | import static org.apiguardian.api.API.Status.STABLE; |
| 14 | |
| 15 | import java.lang.annotation.ElementType; |
| 16 | import java.lang.annotation.Inherited; |
| 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 @Isolated} is used to declare that the annotated test class should be |
| 25 | * executed in isolation from other test classes. |
| 26 | * |
| 27 | * <p>When a test class is run in isolation, no other test class is executed |
| 28 | * concurrently. This can be used to enable parallel test execution for the |
| 29 | * entire test suite while running some tests in isolation (e.g. if they modify |
| 30 | * some global resource). |
| 31 | * |
| 32 | * @since 5.7 |
| 33 | * @see ExecutionMode |
| 34 | * @see ResourceLock |
| 35 | */ |
| 36 | @API(status = STABLE, since = "5.10") |
| 37 | @Retention(RetentionPolicy.RUNTIME) |
| 38 | @Target(ElementType.TYPE) |
| 39 | @Inherited |
| 40 | @ResourceLock(Resources.GLOBAL) |
| 41 | public @interface Isolated { |
| 42 | |
| 43 | /** |
| 44 | * The reason this test class needs to run in isolation. |
| 45 | * |
| 46 | * <p>The supplied string is currently not reported in any way but can be |
| 47 | * used for documentation purposes. |
| 48 | */ |
| 49 | String value() default ""; |
| 50 | |
| 51 | } |